admin管理员组文章数量:1126443
This seems a bit of a hole in Wordpress Roles. I have a site with many cooks (Editors). I would like to give some of them read-only access to Draft and Private materials.
This post goes a little way; Allow a user or role to view drafts and previews, but not other admin privileges? but is not elegant.
I have got this far, but I really would like them to have read-only access
function add_reviewer_role() {
// Does the role exist?
if ( ! ( role_exists( 'reviewer' ) ) ) {
//add the new user role
add_role(
'reviewer',
'Reviewer',
array(
'read' => true,
'edit_others_pages' => true,
'edit_others_posts' => true,
'delete_posts' => false, // Is this necessary?
'read_private_pages' => true,
'read_private_posts' => true,
)
);
}
}
add_action('admin_init', 'add_reviewer_role');
If I was going to be more sophisticated, I would add a capability to access an ACF field to add comments...
版权声明:本文标题:capabilities - Easiest way to create Reviewer Role: Can preview Drafts (and Private Pages) but not Edit them 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736689499a1947845.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论