有可能stop author to publish post, 强迫他Submit For Preview. 只需将此代码添加到functions.php
你们都完了。
<?php
function take_away_publish_permissions() {
$user = get_role(\'author\');
$user->add_cap(\'publish_posts\',false);
}
add_action(\'init\', \'take_away_publish_permissions\' );
?>
**更新代码**
此共享代码用于在作者更新帖子时将帖子状态设置为预览或挂起function postPending($post_ID)
{
if(get_role(\'author\'))
{
//Unhook this function
remove_action(\'post_updated\', \'postPending\', 10, 3);
return wp_update_post(array(\'ID\' => $post_ID, \'post_status\' => \'pending\'));
// re-hook this function
add_action( \'post_updated\', \'postPending\', 10, 3 );
}
}
add_action(\'post_updated\', \'postPending\', 10, 3);
NOTE: 如果调用包含save\\u post挂钩的wp\\u update\\u post等函数,那么挂钩函数将创建一个无限循环。为了避免这种情况,请在调用所需函数之前先取消钩住函数,然后再重新钩住它。有关详细信息,请查看此
link