# Private Admin Notes on User Profiles

> Adds a notes box to user profiles that only administrators can see and edit, for things like support history or account details.

- Type: PHP
- Runs: Admin only
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: users, profile, notes
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/private-admin-notes-on-users/

## Code

```php
$wpide_user_notes_render = function ( $user ) {
    if ( ! current_user_can( 'edit_users' ) ) {
        return;
    }
    ?>
    <h2>Admin Notes</h2>
    <table class="form-table" role="presentation">
        <tr>
            <th><label for="wpide_admin_notes">Private notes</label></th>
            <td>
                <textarea name="wpide_admin_notes" id="wpide_admin_notes" rows="5" class="large-text"><?php echo esc_textarea( get_user_meta( $user->ID, 'wpide_admin_notes', true ) ); ?></textarea>
                <p class="description">Only visible to users who can edit users.</p>
            </td>
        </tr>
    </table>
    <?php
};

add_action( 'show_user_profile', $wpide_user_notes_render );
add_action( 'edit_user_profile', $wpide_user_notes_render );

// WordPress verifies the profile form nonce before these actions run.
$wpide_user_notes_save = function ( $user_id ) {
    if ( current_user_can( 'edit_users' ) && current_user_can( 'edit_user', $user_id ) && isset( $_POST['wpide_admin_notes'] ) ) {
        update_user_meta( $user_id, 'wpide_admin_notes', sanitize_textarea_field( wp_unslash( $_POST['wpide_admin_notes'] ) ) );
    }
};

add_action( 'personal_options_update', $wpide_user_notes_save );
add_action( 'edit_user_profile_update', $wpide_user_notes_save );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Private Admin Notes on User Profiles" 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/
