Wordpress,save_post,post_status并不是数据库中的功能

时间:2018-08-08 07:47:16

标签: wordpress

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进行一些操作,但我不能那样做

0 个答案:

没有答案