Is it fired after a post has been published?
Say I have a CPT and want to perform some automated actions based on the post that gets saved, can I do:
add_action('publish_myt_cpt', 'myfunction');
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityIt is fired in wp-includes/post.php
on line 3026
in the following function:
wp-includes/post.php: line 3014-3027
function wp_transition_post_status($new_status, $old_status, $post) {
do_action('transition_post_status', $new_status, $old_status, $post);
do_action("{$old_status}_to_{$new_status}", $post);
do_action("{$new_status}_{$post->post_type}", $post->ID, $post);
}
$post
in the add_action
. Or add a die('check')
in the add_action
and check the DB when the die hits