跟踪票据\'transition_post_status\' is executed before \'save_post\', 我还在为如何访问new $post
(保存后)在transition_post_status
钩现在,我正在获取旧的$post数据(在保存之前)。
示例:
add_action(\'transition_post_status\',\'myfunc\',10,3);
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
}
}
}
改变优先顺序没有任何区别。有什么办法可以做到这一点吗?