WordPress / developer-blog-content

In this GitHub space, WordPress team coordinates content to be published on the Developer Blog. Discussions and montly meetings (first Thu - 13:00 UTC) in WP Slack #core-dev-blog
https://developer.wordpress.org/news
40 stars 5 forks source link

How to add custom preview options in WP 6.7 #328

Open bph opened 4 weeks ago

bph commented 4 weeks ago

Discussion #315

There's a new Preview Options API coming in WordPress 6.7: https://github.com/WordPress/gutenberg/pull/64644#top

It allows you to add custom options to the preview dropdown in the editor:

image

What we need is a step-by-step walkthrough of how to implement custom preview options. The API is just for adding the preview button in the dropdown, but the onClick() method (what happens when the button is clicked) is custom. We could share several different ideas on what's possible and what it could be used for.