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...

本文标签: capabilitiesEasiest way to create Reviewer Role Can preview Drafts (and Private Pages) but not Edit them