I would like to edit the text or remove and re-create the Publish panel of Gutenberg's PrePublish Panel in the editor sidebar.

I know I can use wp.data.dispatch( 'core/edit-post' ).removeEditorPanel( 'example-panel' ); but it doesn't seem to work for any panels in editor-post-publish-panel. Any ideas? enter image description here

The background is that I used the slotfill API to insert a timezone select field so authors can use their local times when selecting their publish date time. That all works great, except when they click Schedule and get the publish time in GMT without any context.

  • 1
    I guess you're going to need to use something like jQuery's .remove() or .hide() for the time being. But, can you show the code for "I used the slotfill API to insert a timezone select field"?
    – Sally CJ
    Aug 21, 2019 at 7:49
  • Might work. I'd attach a listener to wp.data.select('core/edit-post').isPublishSidebarOpened() and then use a pseudo css class to select the 2nd div in jQuery. Very hacky though and will cause React to redraw everything...
    – spnzr
    Aug 21, 2019 at 16:34
  • Here's a gist of the timezone select: gist.github.com/spencerm/1005327871474b5cecccb1fb9109dda8 (I'm not super familiar with react.js however)
    – spnzr
    Aug 21, 2019 at 16:35
  • 1
    Or actually I can just do a hack-y CSS fix – .editor-post-publish-panel__prepublish :nth-child(4){ visibility:hidden; } ... but it is definitely hack-y haha
    – spnzr
    Aug 21, 2019 at 16:57
  • 1
    Problem with using JS outside of React is it will force React to do a total redraw.
    – spnzr
    Aug 21, 2019 at 19:45


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.