When is the {$new_status}_{$post->post_type} transition hook fired?

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');

Related posts

Leave a Reply

1 comment

  1. It 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);
    }