WordPress.org

Ready to get started?Download WordPress

Forums

Adding "remove_users" Capability (1 post)

  1. Kruncher
    Member
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic