# Private Editorial Notes in the Block Editor

> Adds an "Editorial notes" panel to the editor sidebar where writers and editors leave internal notes about a post, such as sources or open questions, that never appear on the site.

- Type: PHP
- Runs: Run everywhere
- Category: [Content](https://wpide.com/library/category/content/)
- Tags: block-editor, notes, editorial
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/content-editorial-notes-panel/

## Code

```php
add_action( 'init', function () {
    foreach ( array( 'post', 'page' ) as $post_type ) {
        register_post_meta( $post_type, '_wpide_editorial_notes', array(
            'type'              => 'string',
            'single'            => true,
            'show_in_rest'      => true,
            'sanitize_callback' => 'sanitize_textarea_field',
            'auth_callback'     => function ( $allowed, $key, $post_id ) {
                return current_user_can( 'edit_post', $post_id );
            },
        ) );
    }
} );

add_action( 'enqueue_block_editor_assets', function () {
    $screen = get_current_screen();
    if ( ! $screen || 'post' !== $screen->base || ! in_array( $screen->post_type, array( 'post', 'page' ), true ) ) {
        return;
    }

    wp_register_script( 'wpide-editorial-notes', false, array( 'wp-plugins', 'wp-element', 'wp-components', 'wp-data', 'wp-editor' ), '1.0', true );
    wp_enqueue_script( 'wpide-editorial-notes' );
    wp_add_inline_script( 'wpide-editorial-notes', <<<'JS'
( function ( wp ) {
    var el = wp.element.createElement;
    var Panel = ( wp.editor && wp.editor.PluginDocumentSettingPanel ) || ( wp.editPost && wp.editPost.PluginDocumentSettingPanel );
    if ( ! Panel ) { return; }

    function Notes() {
        var notes = wp.data.useSelect( function ( select ) {
            return ( select( 'core/editor' ).getEditedPostAttribute( 'meta' ) || {} )._wpide_editorial_notes || '';
        }, [] );
        var editPost = wp.data.useDispatch( 'core/editor' ).editPost;

        return el( Panel, { name: 'wpide-editorial-notes', title: 'Editorial notes', icon: 'edit' },
            el( wp.components.TextareaControl, {
                label: 'Internal notes (not published)',
                rows: 6,
                value: notes,
                onChange: function ( value ) { editPost( { meta: { _wpide_editorial_notes: value } } ); }
            } )
        );
    }

    wp.plugins.registerPlugin( 'wpide-editorial-notes', { render: Notes } );
} )( window.wp );
JS
    );
} );

add_filter( 'manage_posts_columns', function ( $columns ) {
    $columns['wpide_notes'] = '<span class="dashicons dashicons-format-aside" aria-hidden="true"></span><span class="screen-reader-text">Notes</span>';
    return $columns;
} );

add_action( 'manage_posts_custom_column', function ( $column, $post_id ) {
    if ( 'wpide_notes' !== $column ) {
        return;
    }
    $notes = (string) get_post_meta( $post_id, '_wpide_editorial_notes', true );
    if ( '' !== $notes ) {
        printf( '<span class="dashicons dashicons-format-aside" title="%s" aria-label="Has editorial notes"></span>', esc_attr( wp_trim_words( $notes, 30 ) ) );
    }
}, 10, 2 );
```

## Notes

Notes are stored in the protected _wpide_editorial_notes field and shown as an icon in the Posts list.

## How to use it

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