6

On Classic Editor and Wordress 4.x i used 'post_submitbox_misc_actions' action to add custom control to submit box area. Is there a way to do this in Gutenberg editor? Some equivalent to old action?

Thanks for Your help.

1
wp_enqueue_script(
    'some-slug',
    '/path/to/script.js',
    array( 'wp-edit-post', 'wp-plugins', 'wp-i18n', 'wp-element' ),
    '0.1'
);

script.js:

var el = wp.element.createElement;
var __ = wp.i18n.__;
var registerPlugin = wp.plugins.registerPlugin;
var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
var TextControl = wp.components.TextControl;

function MyPostStatusInfoPlugin({}) {
    return el(
        PluginPostStatusInfo,
        {
            className: 'my-post-status-info'
        },
        el(
            TextControl,
            {
                name: 'my_edit_summary',
                label: __( 'Edit summary' ),
                help: __( 'Briefly summarise your changes' )
            }
        )
    );
}

registerPlugin( 'my-post-status-info-plugin', {
    render: MyPostStatusInfoPlugin
} );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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