# Content for Specific Users Shortcode

> Adds a [wpide_for_users] shortcode that shows its content only to the user accounts you list, handy for private notes to one client on a shared page.

- Type: PHP
- Runs: Run everywhere
- Category: [Memberships](https://wpide.com/library/category/memberships/)
- Tags: shortcode, users, private
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/content-for-specific-users-shortcode/

## Code

```php
add_shortcode( 'wpide_for_users', function ( $atts, $content = '' ) {
    $atts    = shortcode_atts( array( 'ids' => '' ), $atts, 'wpide_for_users' );
    $user_id = get_current_user_id();

    if ( ! $user_id ) {
        return '';
    }

    $ids = array_filter( array_map( 'absint', explode( ',', $atts['ids'] ) ) );

    if ( in_array( $user_id, $ids, true ) || current_user_can( 'manage_options' ) ) {
        return do_shortcode( $content );
    }

    return '';
} );
```

## Notes

Example: [wpide_for_users ids="12,45"]Your files are ready.[/wpide_for_users]. Administrators always see the content.

## How to use it

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