# Give Extra Capabilities to Specific Users

> Grants chosen capabilities to individual user accounts, for example letting one editor manage plugins, without creating a new role.

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

## Code

```php
// User ID => capabilities to add.
$wpide_user_extra_caps = array(
    2 => array( 'edit_theme_options', 'list_users' ),
);

add_filter( 'user_has_cap', function ( $allcaps, $caps, $args, $user ) use ( $wpide_user_extra_caps ) {
    if ( empty( $wpide_user_extra_caps[ $user->ID ] ) ) {
        return $allcaps;
    }

    foreach ( $wpide_user_extra_caps[ $user->ID ] as $cap ) {
        $allcaps[ $cap ] = true;
    }

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

## Notes

Use user IDs, which never change. The capabilities are granted in memory and disappear when the snippet is off.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Give Extra Capabilities to Specific Users" 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/
