# Pre-Publish Checklist in the Block Editor

> Adds a checklist to the block editor's publish panel, such as "Spell-checked" or "Links tested", and keeps the Publish button locked until every item is ticked.

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

## Code

```php
// Checklist items shown before publishing.
$wpide_checklist_items = array(
    'Spelling and grammar checked',
    'Links tested',
    'Featured image and alt text set',
    'Category and tags chosen',
);
// Post types that get the checklist.
$wpide_checklist_types = array( 'post' );

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

    wp_register_script( 'wpide-prepublish-checklist', false, array( 'wp-plugins', 'wp-element', 'wp-components', 'wp-data', 'wp-editor' ), '1.0', true );
    wp_enqueue_script( 'wpide-prepublish-checklist' );
    wp_add_inline_script( 'wpide-prepublish-checklist', 'var wpideChecklistItems = ' . wp_json_encode( array_values( $wpide_checklist_items ) ) . ';' . <<<'JS'
( function ( wp ) {
    var el = wp.element.createElement;
    var Panel = ( wp.editor && wp.editor.PluginPrePublishPanel ) || ( wp.editPost && wp.editPost.PluginPrePublishPanel );
    if ( ! Panel ) { return; }

    function Checklist() {
        var state = wp.element.useState( {} );
        var checked = state[0], setChecked = state[1];
        var done = wpideChecklistItems.every( function ( item, i ) { return checked[ i ]; } );
        var isPublished = wp.data.useSelect( function ( select ) { return select( 'core/editor' ).isCurrentPostPublished(); }, [] );

        wp.element.useEffect( function () {
            var editor = wp.data.dispatch( 'core/editor' );
            if ( done || isPublished ) { editor.unlockPostSaving( 'wpide-checklist' ); } else { editor.lockPostSaving( 'wpide-checklist' ); }
            return function () { editor.unlockPostSaving( 'wpide-checklist' ); };
        }, [ done, isPublished ] );

        return el( Panel, { title: 'Checklist', initialOpen: true },
            wpideChecklistItems.map( function ( item, i ) {
                return el( wp.components.CheckboxControl, {
                    key: i,
                    label: item,
                    checked: !! checked[ i ],
                    onChange: function ( value ) { var next = Object.assign( {}, checked ); next[ i ] = value; setChecked( next ); }
                } );
            } ),
            done ? null : el( 'p', { style: { color: '#b32d2e' } }, 'Tick every item to enable publishing.' )
        );
    }

    wp.plugins.registerPlugin( 'wpide-prepublish-checklist', { render: Checklist } );
} )( window.wp );
JS
    );
} );
```

## Notes

Edit the items in $wpide_checklist_items; ticks are not saved, so the list resets each time the post is published.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Pre-Publish Checklist 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/
