Support » Fixing WordPress » Adding "remove_users" Capability

  • I am using the following code to allow “Editors” to manage users, but I need to prevent “Editors” from removing or demoting “Admins”:

    $editor_role = get_role('editor');
    $editor_role->add_cap('list_users');
    $editor_role->add_cap('create_users');
    $editor_role->add_cap('remove_users');
    $editor_role->add_cap('promote_users');

    Any help would be greatly appreciated!

    Kind regards

  • The topic ‘Adding "remove_users" Capability’ is closed to new replies.