Add or Remove Capabilities to Editor, Author in WordPress

Assign your clients the “Editor” role in WordPress, but give them capability to act like an administrator, without letting them screw up your Pages. This example lets the Editor add and delete users, but stops them from editing the Pages you created for them. In addition, this example gives Authors the capability to create their own categories, in case your client (the ‘Editor’) wants to delegate some responsibility for posting to an ‘Author’.

$edit_editor = get_role('editor'); 
$edit_editor->add_cap('list_users'); 
$edit_editor->add_cap('add_users');
$edit_editor->add_cap('delete_users');
$edit_editor->remove_cap('delete_others_pages'); 
$edit_editor->remove_cap('edit_others_pages');


$edit_author = get_role('author');
$edit_author->add_cap('manage_categories'); 

See more:

We've 2 Responses

  1. September 27th, 2012 at 5:42 pm

    Thank you for the helpful writeup. I am going to borrow some of your code (other article) for removing WP menu items for different capabilities. Just wish there was a was to do it on a Role basis without a plugin. Oh well. Anyways, were you able to have your Editors administrate users? I haven’t been able to get that to work

    Regards,
    Scott

    Scott Grodberg

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]