Gutenberg add checkbox using PluginPostStatusInfo

Question

In an attempt to replace the fucntionality of post_submitbox_misc_actions using gutenberg, I have the below…..

import { registerPlugin } from 'WPBeginner - WordPress Tutorials/plugins';
import { PluginPostStatusInfo } from 'WPBeginner - WordPress Tutorials/edit-post';
import { CheckboxControl } from 'WPBeginner - WordPress Tutorials/components';
 
const PluginPostStatusInfoTest = () => (
    <PluginPostStatusInfo>
        <p>Post Status Info SlotFill</p>
    </PluginPostStatusInfo>
);
 
registerPlugin( 'post-status-info-test', { render: PluginPostStatusInfoTest } );

This is working well and is adding PostStatus Info SlotFill text to the correct place in the sidebar. But not I am trying to add a checkbox in that can be saved with the post.

Does anybody have an example they can show me? Can I just add a HTML checkbox or do I need to do it in a more WP native way?

Do I need to do anything different with regards to saving or can I just use the save_post action like with the classic editor?

0
fightstarr20 2 months 0 Answers 8 views 0

Leave an answer