Wordpress as a CMS - best way to decouple publishing/front-end
For various reasons, this is important, but I am unsure if their are better ways OR other ramifications:
CMS = Wordpress as a CMS.
WebSite = Static site generator.
Currently when a post publishes on CMS I used API to send the info to WebSite which generates the page. All works.
However, I don't want the CMS to ALSO publish post.
I current handle this by redirecting all traffic to CMS to /wp-admin/ page.
This seems not ideal.
I would rather decouple publish button from actually publishing post.
Is this the best way?:
function change_publish( $post_ID )
{
// Do something here //
}
add_action( 'publish_post', 'change_publish' );
I.e. to override the publish function?
Edits per comment from @alx
- I will/would want to utilize the publish post status to indicate the post is published, however to clarify this see below:
- You make a question of Rest API vs. Custom API - to clarify as I can here, with WP Remove Get and Post, I am making HTTP Post and Get requests to other resources, but there could be something you are needing information wise that I am not aware of, I am not utilizing Wordpresses REST API endpoints. To clarify further: When a person hits publish on the post, I've hooked into the publish to initiate an HTTP post statement to a separate resource, where the article actually publishes. However, wordpress, natively still does publish that post to the local site.
- If I have a wordpress instance hosted at myCMS.com - and I hit publish on a post from myCMS.com/wp-admin/ I don't want that post to be available on the front end of myCMS.com - from a browser or endpoint.
Please let me know that clarifies.
Also as an additional note, I assume I could just have posts which are published have a visibility of private or password protected, but is their a true decoupling from the front end publishing?