Categories
gatsby headless headless-cms reactjs wordpress

Does it need to rebuild everytime for new posts? Using gatsby and WordPress

I recently creating sample gatsby with WordPress working fine.
Does it require every time to rebuild to gasby when i add new post or blog on WordPress?

Yes. Use webhooks for triggering an automatic rebuild.

Here an example with netlify:

  1. Setup webhook in Netlify

    Build & Deploy > Continuous Deployment > Build hooks > Add build hook

  2. Go to your WordPress site’s Admin page (

    Settings > Webhooks > Add webhook

    • Action: publish_post
    • Fields: ID (this doesn’t matter)
    • URL: paste your Netlify web hook

Note: this will only cause a rebuild of the site Netlify for new posts, you need to create a separate webhook event to trigger for pages. Although if it can wait, until your next post. Gatsby will pull in those changes to posts too.

Credit goes to this blog post.