# "My Notes" Personal Dashboard Widget

> Adds a "My notes" widget to the dashboard where each user keeps their own private notes and reminders, saved instantly and invisible to everyone else.

- Type: PHP
- Runs: Admin only
- Category: [Dashboard](https://wpide.com/library/category/dashboard/)
- Tags: dashboard-widget, notes, productivity
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/dash-private-notes-widget/

## Code

```php
add_action( 'wp_dashboard_setup', function () {
    wp_add_dashboard_widget( 'wpide_private_notes', 'My notes', function () {
        $note = (string) get_user_meta( get_current_user_id(), 'wpide_private_note', true );
        ?>
        <label for="wpide-private-note" class="screen-reader-text">My notes</label>
        <textarea id="wpide-private-note" rows="6" style="width:100%" maxlength="5000" placeholder="Only you can see these notes."><?php echo esc_textarea( $note ); ?></textarea>
        <p class="description" id="wpide-note-status" aria-live="polite"></p>
        <script>
        ( function () {
            var box = document.getElementById( 'wpide-private-note' );
            var status = document.getElementById( 'wpide-note-status' );
            var saved = box.value;
            box.addEventListener( 'blur', function () {
                if ( box.value === saved ) { return; }
                var body = new FormData();
                body.append( 'action', 'wpide_private_note' );
                body.append( 'nonce', <?php echo wp_json_encode( wp_create_nonce( 'wpide_private_note' ) ); ?> );
                body.append( 'note', box.value );
                status.textContent = 'Saving...';
                fetch( ajaxurl, { method: 'POST', credentials: 'same-origin', body: body } )
                    .then( function ( r ) { return r.json(); } )
                    .then( function ( r ) { saved = box.value; status.textContent = r.success ? 'Saved.' : 'Could not save.'; } );
            } );
        } )();
        </script>
        <?php
    } );
} );

add_action( 'wp_ajax_wpide_private_note', function () {
    check_ajax_referer( 'wpide_private_note', 'nonce' );
    $note = isset( $_POST['note'] ) ? sanitize_textarea_field( wp_unslash( $_POST['note'] ) ) : '';
    update_user_meta( get_current_user_id(), 'wpide_private_note', mb_substr( $note, 0, 5000 ) );
    wp_send_json_success();
} );
```

## Notes

Notes are stored per user, up to 5,000 characters, and saved when you click away from the box.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find ""My Notes" Personal Dashboard Widget" 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/
