# Show a User's Capabilities on Their Profile

> Adds a collapsible list of everything a user is allowed to do to the user edit screen, which helps when checking what a role or plugin has granted.

- Type: PHP
- Runs: Admin only
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: capabilities, roles, debugging
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/user-capabilities-panel/

## Code

```php
$wpide_caps_panel = function ( $user ) {
    if ( ! current_user_can( 'manage_options' ) ) {
        return;
    }

    $caps = array_keys( array_filter( (array) $user->allcaps ) );
    $caps = array_diff( $caps, array_keys( wp_roles()->roles ) );
    sort( $caps );

    echo '<h2>Capabilities</h2><details><summary>' . esc_html( sprintf( '%d capabilities from the roles %s', count( $caps ), implode( ', ', $user->roles ) ) ) . '</summary>';
    echo '<ul style="columns:3 14em;margin-top:1em">';

    foreach ( $caps as $cap ) {
        echo '<li><code>' . esc_html( $cap ) . '</code></li>';
    }

    echo '</ul></details>';
};

add_action( 'show_user_profile', $wpide_caps_panel );
add_action( 'edit_user_profile', $wpide_caps_panel );
```

## Notes

Visible to administrators only; it is read-only and changes nothing.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Show a User's Capabilities on Their Profile" 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/
