admin管理员组

文章数量:1335840

In older WordPress versions I have used post_submitbox_misc_actions. Now with the new Gutenberg editor, I'm struggling to achieve the same functionality with my existing WordPress plugin.

So basically I just need to add a simple checkbox in the "Post & Visibility" section/block in Gutenberg that must not be pre-filled or permanently stored. I just need the information whether the checkbox has been checked or not in the (PHP) WordPress plugin to perform a simple cURL call.

I have managed to add the the checkbox to Gutenberg using an registered JS file and the following code:

function MyPlugin({}) {
    return el(
        PluginPostStatusInfo,
        {
            className: 'my-plugin'
        },
        el(
            CheckboxControl,
            {
                name: 'notify',
                label: __( 'Send notification' ),
            }
        )
    );
}

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

But how can I process/read the checkbox information in my (PHP) WordPress plugin?

Thanks for helping!

本文标签: block editorGet value of custom checkbox from Gutenberg sidebar in plugin