I'm writing a plugin that fetches some data from an XML file and then creates a post based on its content.
I was thinking of using wp_insert_post()
to publish the new post, but I have some functions that are hooked to publish_post
.
After digging in the \wp-includes\post.php
, I couldn't find any publish_post
action hooks that are triggered by this event.
There were only these hooks related to my case:
// Fires once an existing post has been updated.
do_action( 'post_updated', $post_ID, $post_after, $post_before);
// Fires once a post has been saved.
do_action( 'save_post', $post_ID, $post, $update );
//Fires once a post has been saved.
do_action( 'wp_insert_post', $post_ID, $post, $update );
Am I missing something? Or doesn't wp_insert_post()
trigger the publish_post
action?