plugin development - Custom action button in Gutenberg editor (post_submitbox_misc_actions - equivalent)

On Classic Editor and Wordress 4.x i used 'post_submitbox_misc_actions' action to add custom control to submit

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.

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.

Share Improve this question edited Jan 8, 2019 at 16:35 Jerzy Jerzynka asked Jan 8, 2019 at 14:13 Jerzy JerzynkaJerzy Jerzynka 813 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 4
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 = wpponents.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
} );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745334501a4623040.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信