# Hide the Administrator Role From Non-Administrators

> Removes Administrator from the role dropdowns for anyone who is not an administrator, so delegated user managers cannot promote themselves or others.

- Type: PHP
- Runs: Run everywhere
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: users, roles, security
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/hide-administrator-role-option/

## Code

```php
add_filter( 'editable_roles', function ( $roles ) {
    if ( ! current_user_can( 'manage_options' ) ) {
        unset( $roles['administrator'] );
    }

    return $roles;
} );
```

## Notes

Useful whenever you give a non-administrator the ability to manage users.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide the Administrator Role From Non-Administrators" 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/
