Support » Plugin: Gutenberg » How to have a PluginDocumentSettingPanel initially opened?

  • Resolved Benny


    I have added a PluginDocumentSettingPanel plugin to my WP plugin.
    Is there a way to have the panel initially opened?

    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>
     registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );

    The PluginPostPublishPanel has a property initialOpen that can be set to true but that isn’t available/working for PluginDocumentSettingPanel.

    Is there still a way to achieve the same for a PluginPostPublishPanel plugin?

Viewing 1 replies (of 1 total)
  • Plugin Author Jorge Costa


    Hi @benny,

    You may programmatically open the panel by using: ‘core/edit-post’ ).toggleEditorPanelOpened( panelName ).
    The block editor persists what panels the user opened and closed, so ideally that code should only be executed one time. I guess one way to accomplish this is checking that ‘panels’ )[ panelName ] is undefined before executing the action.

    I hope you find my answer useful, feel free to comment if you need additional clarification.

Viewing 1 replies (of 1 total)
  • The topic ‘How to have a PluginDocumentSettingPanel initially opened?’ is closed to new replies.