Following up the ticket 'transition_post_status' is executed before 'save_post', I'm still struggling how to access the new $post (after it has been saved) inside a transition_post_status hook. Right now, I'm getting the old $post data (before it has been saved).


function myfunc($new_status,$old_status,$post){

 if ( $new_status == 'publish' && $old_status != 'publish') {
 // a post is getting published

    if(!check_my_post($post->ID)){ //how can I get the saved/new post here?
        // do something     

Changing priorities does not make any difference.

Any ideas how to achieve this?

  • While the hook does fire before save_post one, both of them fire after data had been actually updated and should pass new instance. Your code not aligned with your assumptions somewhere.
    – Rarst
    Jun 22, 2014 at 20:38

1 Answer 1


According to the Codex, if you use wp_transition_post_status() you will get both the old version and the new version.

 wp_transition_post_status( $new_status, $old_status, $post ) 

The ticket also says that the post type needs to support revisions for the save to work.

Check the post type of the post objects before doing anything.

If your post type supported revisions, you'd see both actions fire twice -- transition then save for the revision, transition then save for the post.

Would it be possible for you to use wp_transition_post_status()? And have you ensured that your post type supports revisions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.