# Let Site Admins Edit Their Own Site's Users

> Allows site administrators to edit the profiles of users who belong to their site, which multisite normally reserves for super admins.

- Type: PHP
- Runs: Run everywhere
- Category: [Multisite](https://wpide.com/library/category/multisite/)
- Tags: users, site-admins, permissions
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/ms-site-admins-edit-users/

## Code

```php
if ( ! is_multisite() ) {
    return;
}

add_filter( 'map_meta_cap', function ( $caps, $cap, $user_id, $args ) {
    if ( 'edit_user' !== $cap || empty( $args[0] ) || is_super_admin( $user_id ) ) {
        return $caps;
    }

    $target = (int) $args[0];
    $blog   = get_current_blog_id();

    if ( $target === (int) $user_id || is_super_admin( $target ) || ! user_can( $user_id, 'promote_users' ) ) {
        return $caps;
    }

    if ( is_user_member_of_blog( $target, $blog ) && 1 === count( get_blogs_of_user( $target ) ) ) {
        return array( 'edit_users' );
    }

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

## Notes

Site admins can never edit super admins or users who belong to other sites as well, because profile changes are network-wide.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Let Site Admins Edit Their Own Site's 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/
