我正在尝试将更新设置为Pending
vs。Publish
对于我创建的新角色,调用"members". 有没有办法只删除Publish
这些用户的选项?我试过的用户插件都没有起作用。他们会将其设置为Pending
用于新帖子,但不用于编辑帖子。我需要它来编辑。
自定义域-如何删除某些用户的发布选项
1 个回复
SO网友:JMau
您可以这样做:
function wpse_113057_hide_publish_buttons(){
$cpt = \'your_post_type\';// can be post
global $post;
if($post->post_type == $cpt && current_user_can(\'members\') ){
echo \'
<style type="text/css">
.misc-pub-section, #delete-action {
display:none;
}
</style>
\';
}
}
add_action(\'admin_head-post.php\', \'wpse_113057_hide_publish_buttons\');
add_action(\'admin_head-post-new.php\', \'wpse_113057_hide_publish_buttons\');
我没有找到一个钩子来用一些PHP实现这一点。希望这有帮助。
结束