Custom publish_customposttype action
-
I’m looking into using WordPress as a headless CMS for use in conjunction with a GatsbyJS static frontend. My frontend code is built by GitLab CI/CD.
Currently my frontend code pulls site content straight from the WP API on page load. This isn’t really a static solution. It would be better to trigger a CI/CD pipeline that builds a completely static frontend through their API whenever someone saves a custom post.
.
It would be great if we could have an input field in custom post settings that takes the name/names of functions that will be ran on publish.
add_action('publish_customposttype', 'func_name');By leaving implementation of the actual function up to the developer, this feature could be used to trigger all kinds of things: CI/CD Pipelines on a variety of platforms, Slack notifications, other WP core functions, etc.
.
I was inspired by this WP plugin: https://github.com/kmturley/wordpress-gitlab-trigger-pipeline/blob/master/gitlab-trigger-pipeline.php
The topic ‘Custom publish_customposttype action’ is closed to new replies.