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" !
}
然后在数据库中有“ publish
”,我得到get_post($post_id)->post_status
=>'inherit
'!
或数据库中有“ draft
”,我得到get_post($post_id)->post_status
=>'revision
'!
为什么?我需要根据post_status进行一些操作,但我不能那样做