我找不到任何调用的操作wp_update_post
. 你确定这是有效的吗?让我们试试钩子publish_post
.
add_action(\'publish_post\', \'check_user_publish\', 10, 2);
function check_user_publish ($post_id, $post) {
$user_id = get_current_user_id();
if ($user_id != $post->post_author)
return;
$query = array(
\'ID\' => $post_id,
\'post_status\' => \'draft\',
);
wp_update_post( $query, true );
}}
未测试代码