Automatically trigger Netlify deploys for WordPress changes

Jason Lengstorf
InstructorJason Lengstorf
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

If we want to make sure our Jamstack sites are always up-to-date, we need to set up a deploy hook and configure WordPress to trigger a rebuild whenever changes are made in the admin dashboard. In this video, we’ll create a webhook and configure a WordPress plugin to trigger Netlify rebuilds when our WordPress content changes.

Jason Lengstorf: [0:00] In order to rebuild our Gatsby site whenever changes are made on WordPress, we need to add a new plugin. We'll go to the new plugin screen and we're going to search for jamstack.

[0:14] This JAMstack Deployments plugin is what we want, so we're going to install that and activate. Once it's installed and activated, we can go to Settings and Deployments. Now, we need to get our configuration information from Netlify.

[0:33] If we go to our Netlify dashboard and into the site that we just created, we can go to Settings, Build & deploy. Then we can come down to our build hooks. We're going to add a new build hook. We'll call this WordPress deployment. Save. Then we can copy this value here. Put that right in. We're going to keep it as a post.

[1:06] The badge image is optional, but it is nice to see whether or not our build succeeded or failed. We can go into our General settings and scroll down, and we'll see the Deploy status badge. There are two URLs here. The first one is for the badge itself. We're going to copy that and put it here. Then we're going to get the link, which is for the actual deploys, and we'll put that here.

[1:37] Here we can choose when the site rebuilds. We want to rebuild when Post change, Pages, Navigation Menu Items. We change our Blocks and this Nav Menu as well.

[1:52] If we're using categories or tags, we could choose those. If we wanted to, we could set all of these. It's really up to you. We will save. Then down here, if we go to one of our pages, let's go to the About, and we can say, "Isn't this neat?"

[2:16] We'll update, and if all went according to plan, when we come back out to our deploys, we'll see, it's now building because of that WordPress change.

[2:29] Which means that whenever someone makes an update to our WordPress site, the Netlify site will rebuild in about one minute later, which is usually about as fast as it would take to clear a cache if you were using a PHP server. Our site will be live with the changes. In as long as it's taken me to talk about what's going on, we're just about done here.

[2:50] There it goes. Post-processing and it's live. If we go back out and we go to our About page, refresh, there it is. Isn't this neat?

egghead
egghead
~ 17 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today