0

I'm trying to grant the user role 'editor' to have access to the Users top-level menu, and then control which sub-menus they have access to. The add_action lives in the _construct method.

add_action( 'admin_menu', array( $this, 'action_admin_menu' ) );

public function action_admin_menu() {
        $edit_contributor = get_role( 'editor' );
        $edit_contributor->add_cap( 'edit_users' );
    }

I'm expecting the Users menu to appear for an Editor, but it's not working.

0

I am not claiming this is a canonical list but the user related capabilities I see are:

  • add_users
  • create_users
  • delete_users
  • edit_users
  • list_users
  • promote_users
  • remove_users

I got this working with only list_users and edit_users. I did test all combinations of those, just a few obvious ones. Of course, you may want more capabilities than that.

  • What hook did you use: admin_menu or admin_init? The editor had access to the Users menu? – AlxVallejo Jan 29 '13 at 18:08
  • Ah, nevermind, this was a caching issue. – AlxVallejo Jan 29 '13 at 18:11
  • I didn't use a hook. I used a plugin to mess with the capabilities. Sorry, I thought the issue was only with "which capability" not with the broader hook function. – s_ha_dum Jan 29 '13 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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