0
add_action("save_post", [$this, "save"]);

function save($postId)
{
    $post = get_post($post_id);
    echo $post->post_status; // its "inherit" instead of "publish" !
    echo $post->post_status; // its "revision" instead of "draft" !
}

and then in database there is "publish", I get get_post($post_id)->post_status => 'inherit' !

or in database there is "draft", I get get_post($post_id)->post_status => 'revision' !

Why? I need to do some operations based on post_status and I cant do it like that

  • 1
    Sorry but I'm really confused what the problem is - can you try rewording your question? Also there is a typo in your code snippet, param $postId but using $post_id – TheDeadMedic Aug 8 '18 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.