WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have added a custom post type "Review", and a custom role "Reviewer". The issue is when logged as admin I take review which current author is admin and I want to change author to a Reviewer I have no options in dropdown besides admin. When I change a post whose author is a Reviewer, I have 2 options in dropdown: the current author and admin. Other Reviewers are not visible.

here is a part with capabilities

'capabilities' => array(
    'edit_post' => 'edit_review',
    'edit_others_posts' => 'edit_others_reviews',
    'publish_posts' => 'publish_reviews',
    'read_post' => 'read_swpd_review',
    'read_private_posts' => 'read_private_reviews',
    'delete_post' => 'delete_swpd_review'

and setting new role

/* Add guest author role to the blog */
add_role('reviewer', 'Reviewer', array('edit_review','read_review','delete_review'));

//add capabilities for admin
$role_object = get_role( 'administrator' );
$role_object->add_cap( 'read_review' );
$role_object->add_cap( 'edit_review' );
$role_object->add_cap( 'delete_review' );
$role_object->add_cap( 'publish_reviews' );
$role_object->add_cap( 'edit_others_reviews' );
//set level for reviewer (should fix a dropdown bug)
$role_object = get_role( 'reviewer' );

Is it a matter of capabilities? What could be wrong?

share|improve this question

The role "Reviewer" only has special capabilities, no other capabilities. To get into the author list you have to be at least a contributor or author.

function rb_addroles() {
    $role = get_role('contributor');
    remove_role( 'reviewer' );
    add_role( 'reviewer', 'Reviewer', $role->capabilities );

    $reviewer = get_role('reviewer');

    $reviewer->add_cap( 'edit_review' );
    $reviewer->add_cap( 'read_review' );
    $reviewer->add_cap( 'delete_review' );
add_action( 'admin_init', 'rb_addroles' );

With this function a reviewer has contributor capabilities plus your special reviewer capabilities. You can change contributor in author to give them also editable powers in the back-end.

Btw you have to run the script only once, preferable in a plugin or functions.php with logged in admin account.

You can check the role by:

$reviewer = get_role('reviewer');
share|improve this answer
This seemd to be a good idea but it did not work :( I think you have a small error in your code. Instead $reviewer = get_role('editor'); you should have $reviewer = get_role('reviewer');, but fixing this did not help. – HoGo Jan 2 '13 at 22:09
You're right on editor > reviewer. I tested it on my WP install and there the role is successfully added with the custom capabilities. What doesn't work right now? – Rob Vermeer Jan 2 '13 at 23:11
Still the same. Entering a custom post clicking dropdown for changing the author and only admin is available. I use this in plugin and I have included your function in main file. – HoGo Jan 2 '13 at 23:24
Can you update the user (just go the the user with role "Reviewer" and click update user) and see if the user than pops up @ author dropdown? – Rob Vermeer Jan 2 '13 at 23:33
No, it does not :( – HoGo Jan 2 '13 at 23:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.