Before publishing an unpublished article pre-publish checks are shown.

How can I extend this programmatically, and disable the publish button if the checks are not passed?

prepublish check


1 Answer 1


This got me started.

Set up the block with create-guten-block Gitub

Update block.js to something like:

import './style.scss';
import './editor.scss';

var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;
var registerPlugin = wp.plugins.registerPlugin;

function Component() {
    //do stuff
    return wp.element.createElement(
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        'Panel content'

registerPlugin( 'my-plugin', {
  render: Component,
  • I'm not sure how WP intends the pluginPrePublishPanel to be used, but locking/unlocking post saving directly inside of a function component definitely is not a good way to do it and will lead to bugs.
    – inwerpsel
    Mar 19, 2021 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.