How can I add custom metabox in document tab in gutenberg?
There is documentation about adding plugin sidebar here, but I’m looking for adding custom metabox in existing document tab.
3 s
Here is the solution. Hope it will help you
const { registerPlugin } = wp.plugins; const { PluginDocumentSettingPanel } = wp.editPost; const MyDocumentSettingTest = () => ( <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel"> <p>My Document Setting Panel</p> </PluginDocumentSettingPanel> ); registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
https://github.com/WordPress/gutenberg/blob/master/packages/edit-post/src/components/sidebar/plugin-document-setting-panel/index.js#L86