WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] show editor the user list (3 posts)

  1. Mark Dalderup
    Member
    Posted 1 year ago #

    Hello,

    I am trying to give my editors access to the users list in the admin panel , I have added the following code to the function.php of my theme but it doesn't seem to work

    function add_user_caps() {
        // gets the author role
        $role = get_role( 'editor' );
    
        // This only works, because it accesses the class instance.
        // would allow the author to edit others' posts for current theme only
        $role->add_cap( 'edit_users' );
    }
    add_action( 'admin_init', 'add_user_caps');

    but when I log in as editor I still cannot access the user list only the profile page, what am I doing wrong?

    Thanks and greetings Mark,

  2. keesiemeijer
    moderator
    Posted 1 year ago #

  3. Mark Dalderup
    Member
    Posted 1 year ago #

    That plugin didn't work,probably because of some conflict with another one but it did give me the term which I was looking for.

    Its not edit_users but list_users. Then the code above works.

    Its weird that list_users also gives you the capability to edit users but I am not complaining since this does exactly what I want.

    thanks for your help

Topic Closed

This topic has been closed to new replies.

About this Topic