Auto Deploy Gatsby WordPress
In this tutorial I’ll go over setting up an auto deploy for your Gatsby project when you save a WordPress post. This Gatsby WordPress webhook is very straight forward and should be a breeze. I imagine if your here you already have a working Gatsby project. Have a Github repo for your Gatsby project (other git providers work as well) and have a WordPress install running on a server. You will also need to create a free account on Netlify. If your unfamiliar or just need a refresher here are some useful resources.
Prerequisite resources
1000Ft Overview
So the 1000 foot view of how it works. Think of Netlify as the brain of this whole deal. It hosts your finished app(production files) and when it recieves prompts from either github or wordpress it rebuilds the app. If your repo changes on github, github will tell Netlify and Netlify will rebuild. If you save changes on wordpress, wordpress will tell the Webhook(on Netlify) which will rebuild.

Setting up Netlify
Netlify is an all-in-one platform for automating modern web projects. Replace your hosting infrastructure, continuous integration, and deployment pipeline with a single workflow. Integrate dynamic functionality like serverless functions, user authentication, and form handling as your projects grow.
- 1. Sign up for a free account on Netlify.
- 2. Go to your Sites page, open the Add new site menu, and select Import an existing project.
- 3. Select the Git provider where your project is hosted.
- 4. Select your project’s existing github repository.

Now you should see your deploy happen in your project under the deploy tab. Almost done we now need to create a webhook in our Netlify dashboard. In your Netlify dash go to into site settings and scroll down to find Build hooks. Click to add a build hook and choose whatever name you like. We need the generated URL.

Congrats hard parts over!
All there is to do now is to send a post request to your webhook url anytime you save a post or page on wordpress which will trigger a deploy. You can do this in any number of ways like writting a PHP function in your functions.php. However if your like me and have trouble with PHP and the seemingly endless suply of answers that almost always lead to another rabbit hole your in luck. We will use a plugin. Go to your wordpress backend and install WP Webhooks by Ironikus

Once installed head into the settings of the plugin and select Send Data from the top menu then Post created on the left side menu. Now name your webhook and past in the Nelify Webhook Url you created earlier, also you should repeat the same process choosing Post updated and Post deleted from the left hand menu. Try updating or creating a post and watch as your Netlify deploy tab light up and begins building.

That’s it! All done! I hope I saved you the hours or days googling I spent trying different methods. And that’s just scratching the surface WP Webhooks by Ironikus has alot of features just in the base plugin that I haven’t even had a second to really explore.