Configuring Build Hooks
What Are Build Hooks?
Build hooks enable certain events in the CMS to trigger builds of a decoupled frontend; such as content updates to post, or publishing a new page.
Installing the WP Webhooks Plugin
If you are using the Decoupled WordPress Composer Managed starter template, the WP Webhooks plugin will already be included as a Composer dependency. It will need to be activated in the WordPress admin dashboard.
For other projects, install and activate the WP Webhooks Plugin as outlined in the plugin documentation.
Creating a Build Hook That Triggers When a Post Is Published
- After generating a build hook on your build platform, navigate to your WordPress admin dashboard and open the WP Webhooks settings.
- Click on the Send Data tab.
- Select the Post Updated Webhook trigger.
- Click Add Webhook URL, name the hook and paste the build hook URL that you generated in the Webhook URL field. Submit this form.
- Under the Action menu for the hook you created, select settings.
- Under the Trigger on post status setting enter publish and toggle the fire only once per instance option on. Save your settings.
Testing Your Build Hook
- Open your WordPress admin dashboard.
- Create a new Post or update a previously existing one.
- Observe that a new build has been triggered on your build platform.