How to make WordPress ‘editor’ role to list/view/add/edit users only with the role ‘author’?


I have added some extra capabilities to the existing ‘editor‘ role in wordpress with:

function add_uedit_caps() {
    $role = get_role('editor');
add_action('admin_init', 'add_uedit_caps');

This piece works fine.


The above code works to list and view all types of users by the ‘editor’. But if a new user added by the ‘editor’, it takes up the ‘new user default role’ set up in wordpress (reference), ie the role set in settings > general. No role change option is available too in the user edit mode.

I want the ‘editors‘ to list/view/add/edit only the users with the role ‘author‘. How can I achieve this through code (a method or class with action) and WITHOUT any plugin or tampering the core files?

sariDon 8 months 2020-11-27T12:10:30-05:00 0 Answers 12 views 0

Leave an answer