Skip to main content
Notice removed Authoritative reference needed by Christine Cooper
Bounty Ended with Welcher's answer chosen by Christine Cooper
deleted 1 character in body
Source Link

The introduction of the Block Editor killed all plugins which offered publishing conditions, such as minimum word counts, featured image requirements etc.

But the Block Editor did introduce the pre-publish checks:

Pre-publish checks

Beautiful. How can we disable the Publish button until a set amount of conditions have been fulfilled?

Examples of four (very) different conditions:

  1. Minimum word count (example: 500 words)
  2. Min/max tags (example: 3-5 tags)
  3. Min category (that isn't uncategorized)
  4. Featured image is assigned

What we have so far

As expected, the documentation is non-existent. But leads are scattered across the web.

In core/editor, we can use .lockPostSaving() to disabled the Publish button, and unlock it via .unlockPostSaving().

We can add a panel to the pre-publish screen via PluginPrePublishPanel. Example (by MadMaardigan):

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

function Component() {
    // lock post saving
    wp.data.dispatch('core/editor').lockPostSaving()

    // unlock post saving
    // wp.data.dispatch('core/editor').unlockPostSaving()

    return wp.element.createElement(
        PluginPrePublishPanel,
        {   
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        },  
        'Panel content'
    );  
}

registerPlugin( 'my-plugin', {
  render: Component,
});

It works:

Custom pre-publish panel

We alsoAnd we have great discussions on GitHub: #7020, #7426, #13413, #15568, #10649...

The introduction of the Block Editor killed all plugins which offered publishing conditions, such as minimum word counts, featured image requirements etc.

But the Block Editor did introduce the pre-publish checks:

Pre-publish checks

Beautiful. How can we disable the Publish button until a set amount of conditions have been fulfilled?

Examples of four (very) different conditions:

  1. Minimum word count (example: 500 words)
  2. Min/max tags (example: 3-5 tags)
  3. Min category (that isn't uncategorized)
  4. Featured image is assigned

What we have so far

As expected, the documentation is non-existent. But leads are scattered across the web.

In core/editor, we can use .lockPostSaving() to disabled the Publish button, and unlock it via .unlockPostSaving().

We can add a panel to the pre-publish screen via PluginPrePublishPanel. Example (by MadMaardigan):

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

function Component() {
    // lock post saving
    wp.data.dispatch('core/editor').lockPostSaving()

    // unlock post saving
    // wp.data.dispatch('core/editor').unlockPostSaving()

    return wp.element.createElement(
        PluginPrePublishPanel,
        {   
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        },  
        'Panel content'
    );  
}

registerPlugin( 'my-plugin', {
  render: Component,
});

It works:

Custom pre-publish panel

We also have great discussions on GitHub: #7020, #7426, #13413, #15568, #10649...

The introduction of the Block Editor killed all plugins which offered publishing conditions, such as minimum word counts, featured image requirements etc.

But the Block Editor did introduce the pre-publish checks:

Pre-publish checks

Beautiful. How can we disable the Publish button until a set amount of conditions have been fulfilled?

Examples of four (very) different conditions:

  1. Minimum word count (example: 500 words)
  2. Min/max tags (example: 3-5 tags)
  3. Min category (that isn't uncategorized)
  4. Featured image is assigned

What we have so far

As expected, the documentation is non-existent. But leads are scattered across the web.

In core/editor, we can use .lockPostSaving() to disabled the Publish button, and unlock it via .unlockPostSaving().

We can add a panel to the pre-publish screen via PluginPrePublishPanel. Example (by MadMaardigan):

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

function Component() {
    // lock post saving
    wp.data.dispatch('core/editor').lockPostSaving()

    // unlock post saving
    // wp.data.dispatch('core/editor').unlockPostSaving()

    return wp.element.createElement(
        PluginPrePublishPanel,
        {   
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        },  
        'Panel content'
    );  
}

registerPlugin( 'my-plugin', {
  render: Component,
});

It works:

Custom pre-publish panel

And we have great discussions on GitHub: #7020, #7426, #13413, #15568, #10649...

Tweeted twitter.com/StackWordPress/status/1136150858415169536
Notice added Authoritative reference needed by Christine Cooper
Bounty Started worth 200 reputation by Christine Cooper
added 4 characters in body
Source Link

The introduction of the Block Editor killed all plugins which offered publishing conditions, such as minimum word counts, featured image requirements etc.

But the Block Editor did introduce the pre-publish checks:

Pre-publish checks

Beautiful. How can we disable the Publish button until a set amount of conditions have been fulfilled?

Examples of four (very) different conditions:

  1. Minimum word count (example: 500500 words)
  2. Min/max tags (example: 3-53-5 tags)
  3. Min category (that isn't uncategorized)
  4. Featured image is assigned

What we have so far

As expected, the documentation is non-existent. But leads are scattered across the web.

In core/editor, we can use .lockPostSaving() to disabled the Publish button, and unlock it via .unlockPostSaving().

We can add a panel to the pre-publish screen via PluginPrePublishPanel. Example (by MadMaardigan):

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

function Component() {
    // lock post saving
    wp.data.dispatch('core/editor').lockPostSaving()

    // unlock post saving
    // wp.data.dispatch('core/editor').unlockPostSaving()

    return wp.element.createElement(
        PluginPrePublishPanel,
        {   
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        },  
        'Panel content'
    );  
}

registerPlugin( 'my-plugin', {
  render: Component,
});

It works:

Custom pre-publish panel

We also have great discussions on GitHub: #7020, #7426, #13413, #15568, #10649...

The introduction of the Block Editor killed all plugins which offered publishing conditions, such as minimum word counts, featured image requirements etc.

But the Block Editor did introduce the pre-publish checks:

Pre-publish checks

Beautiful. How can we disable the Publish button until a set amount of conditions have been fulfilled?

Examples of four (very) different conditions:

  1. Minimum word count (example: 500 words)
  2. Min/max tags (example: 3-5 tags)
  3. Min category (that isn't uncategorized)
  4. Featured image is assigned

What we have so far

As expected, the documentation is non-existent. But leads are scattered across the web.

In core/editor, we can use .lockPostSaving() to disabled the Publish button, and unlock it via .unlockPostSaving().

We can add a panel to the pre-publish screen via PluginPrePublishPanel. Example (by MadMaardigan):

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

function Component() {
    // lock post saving
    wp.data.dispatch('core/editor').lockPostSaving()

    // unlock post saving
    // wp.data.dispatch('core/editor').unlockPostSaving()

    return wp.element.createElement(
        PluginPrePublishPanel,
        {   
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        },  
        'Panel content'
    );  
}

registerPlugin( 'my-plugin', {
  render: Component,
});

It works:

Custom pre-publish panel

We also have great discussions on GitHub: #7020, #7426, #13413, #15568, #10649...

The introduction of the Block Editor killed all plugins which offered publishing conditions, such as minimum word counts, featured image requirements etc.

But the Block Editor did introduce the pre-publish checks:

Pre-publish checks

Beautiful. How can we disable the Publish button until a set amount of conditions have been fulfilled?

Examples of four (very) different conditions:

  1. Minimum word count (example: 500 words)
  2. Min/max tags (example: 3-5 tags)
  3. Min category (that isn't uncategorized)
  4. Featured image is assigned

What we have so far

As expected, the documentation is non-existent. But leads are scattered across the web.

In core/editor, we can use .lockPostSaving() to disabled the Publish button, and unlock it via .unlockPostSaving().

We can add a panel to the pre-publish screen via PluginPrePublishPanel. Example (by MadMaardigan):

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

function Component() {
    // lock post saving
    wp.data.dispatch('core/editor').lockPostSaving()

    // unlock post saving
    // wp.data.dispatch('core/editor').unlockPostSaving()

    return wp.element.createElement(
        PluginPrePublishPanel,
        {   
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        },  
        'Panel content'
    );  
}

registerPlugin( 'my-plugin', {
  render: Component,
});

It works:

Custom pre-publish panel

We also have great discussions on GitHub: #7020, #7426, #13413, #15568, #10649...

deleted 1 character in body
Source Link

The introduction of the Block Editor killed all plugins which offered publishing conditions, such as minimum word counts, featured image requirements etc.

But the Block Editor did introduce the pre-publish checks:

Pre-publish checks

Beautiful. How can we disable the Publish button until a set amount of conditions have been fulfilled.?

Examples of four (very) different conditions:

  1. Minimum word count (example: 500 words)
  2. Min/max tags (example: 3-5 tags)
  3. Min category (that isn't uncategorized)
  4. Featured image is assigned

What we have so far

As expected, the documentation is non-existent. But leads are scattered across the web.

In core/editor, we can use .lockPostSaving() to disabled the Publish button, and unlock it via .unlockPostSaving().

We can add a panel to the pre-publish screen via PluginPrePublishPanel. Example (by MadMaardigan):

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

function Component() {
    // lock post saving
    wp.data.dispatch('core/editor').lockPostSaving()

    // unlock post saving
    // wp.data.dispatch('core/editor').unlockPostSaving()

    return wp.element.createElement(
        PluginPrePublishPanel,
        {   
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        },  
        'Panel content'
    );  
}

registerPlugin( 'my-plugin', {
  render: Component,
});

It works:

Custom pre-publish panel

We also have great discussions on GitHub: #7020, #7426, #13413, #15568, #10649...

The introduction of the Block Editor killed all plugins which offered publishing conditions, such as minimum word counts, featured image requirements etc.

But the Block Editor did introduce the pre-publish checks:

Pre-publish checks

Beautiful. How can we disable the Publish button until a set amount of conditions have been fulfilled.

Examples of four (very) different conditions:

  1. Minimum word count (example: 500 words)
  2. Min/max tags (example: 3-5 tags)
  3. Min category (that isn't uncategorized)
  4. Featured image is assigned

What we have so far

As expected, the documentation is non-existent. But leads are scattered across the web.

In core/editor, we can use .lockPostSaving() to disabled the Publish button, and unlock it via .unlockPostSaving().

We can add a panel to the pre-publish screen via PluginPrePublishPanel. Example (by MadMaardigan):

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

function Component() {
    // lock post saving
    wp.data.dispatch('core/editor').lockPostSaving()

    // unlock post saving
    // wp.data.dispatch('core/editor').unlockPostSaving()

    return wp.element.createElement(
        PluginPrePublishPanel,
        {   
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        },  
        'Panel content'
    );  
}

registerPlugin( 'my-plugin', {
  render: Component,
});

It works:

Custom pre-publish panel

We also have great discussions on GitHub: #7020, #7426, #13413, #15568, #10649...

The introduction of the Block Editor killed all plugins which offered publishing conditions, such as minimum word counts, featured image requirements etc.

But the Block Editor did introduce the pre-publish checks:

Pre-publish checks

Beautiful. How can we disable the Publish button until a set amount of conditions have been fulfilled?

Examples of four (very) different conditions:

  1. Minimum word count (example: 500 words)
  2. Min/max tags (example: 3-5 tags)
  3. Min category (that isn't uncategorized)
  4. Featured image is assigned

What we have so far

As expected, the documentation is non-existent. But leads are scattered across the web.

In core/editor, we can use .lockPostSaving() to disabled the Publish button, and unlock it via .unlockPostSaving().

We can add a panel to the pre-publish screen via PluginPrePublishPanel. Example (by MadMaardigan):

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

function Component() {
    // lock post saving
    wp.data.dispatch('core/editor').lockPostSaving()

    // unlock post saving
    // wp.data.dispatch('core/editor').unlockPostSaving()

    return wp.element.createElement(
        PluginPrePublishPanel,
        {   
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        },  
        'Panel content'
    );  
}

registerPlugin( 'my-plugin', {
  render: Component,
});

It works:

Custom pre-publish panel

We also have great discussions on GitHub: #7020, #7426, #13413, #15568, #10649...

Source Link
Loading