# Private Notes on the Plugins Screen

> Adds a "Note" link under each plugin on the Plugins screen where administrators can record why it is installed, who requested it or what to check after updates.

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

## Code

```php
add_filter( 'plugin_row_meta', function ( $meta, $file ) {
    if ( ! current_user_can( 'activate_plugins' ) ) {
        return $meta;
    }
    $notes = (array) get_option( 'wpide_plugin_notes', array() );
    $note  = $notes[ $file ] ?? '';

    $meta[] = sprintf(
        '<span class="wpide-plugin-note" data-plugin="%s" data-note="%s">%s<a href="#" class="wpide-edit-note">%s</a></span>',
        esc_attr( $file ),
        esc_attr( $note ),
        $note ? '<em style="color:#3c434a">' . esc_html( $note ) . '</em> &middot; ' : '',
        $note ? 'Edit note' : 'Add note'
    );
    return $meta;
}, 10, 2 );

add_action( 'wp_ajax_wpide_plugin_note', function () {
    check_ajax_referer( 'wpide_plugin_note', 'nonce' );
    if ( ! current_user_can( 'activate_plugins' ) ) {
        wp_send_json_error( null, 403 );
    }
    $plugin = isset( $_POST['plugin'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) : '';
    $note   = isset( $_POST['note'] ) ? sanitize_text_field( wp_unslash( $_POST['note'] ) ) : '';
    $notes  = (array) get_option( 'wpide_plugin_notes', array() );

    if ( '' === $note ) {
        unset( $notes[ $plugin ] );
    } else {
        $notes[ $plugin ] = $note;
    }
    update_option( 'wpide_plugin_notes', $notes, false );
    wp_send_json_success();
} );

add_action( 'admin_footer-plugins.php', function () {
    ?>
    <script>
    document.addEventListener( 'click', function ( event ) {
        var link = event.target.closest( '.wpide-edit-note' );
        if ( ! link ) { return; }
        event.preventDefault();
        var wrap = link.closest( '.wpide-plugin-note' );
        var note = window.prompt( 'Note for this plugin (leave empty to remove):', wrap.dataset.note );
        if ( null === note ) { return; }
        var body = new FormData();
        body.append( 'action', 'wpide_plugin_note' );
        body.append( 'nonce', <?php echo wp_json_encode( wp_create_nonce( 'wpide_plugin_note' ) ); ?> );
        body.append( 'plugin', wrap.dataset.plugin );
        body.append( 'note', note );
        fetch( ajaxurl, { method: 'POST', credentials: 'same-origin', body: body } ).then( function () { window.location.reload(); } );
    } );
    </script>
    <?php
} );
```

## Notes

Notes are saved in one option and only visible to users who can manage plugins.

## How to use it

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