# Let Editors See the Users List (Read-Only)

> Lets editors open the Users screen to look people up, without being able to add, edit, promote or delete anyone.

- Type: PHP
- Runs: Run everywhere
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: editors, users, capabilities
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/editors-view-users-list/

## Code

```php
// Roles that may view the Users list.
$wpide_list_users_roles = array( 'editor' );

add_filter( 'user_has_cap', function ( $allcaps, $caps, $args, $user ) use ( $wpide_list_users_roles ) {
    if ( in_array( 'list_users', $caps, true ) && array_intersect( $wpide_list_users_roles, (array) $user->roles ) ) {
        $allcaps['list_users'] = true;
    }

    return $allcaps;
}, 10, 4 );
```

## Notes

Grants only the list_users capability, in memory; turning the snippet off removes it.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Let Editors See the Users List (Read-Only)" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
