How to display InnerBlocks in render callback

save (JS) By default, the save function outputs the content using this as return: <InnerBlocks.Content /> This part is ok, you should still return <InnerBlocks.Content /> in your save function: save: props => <InnerBlocks.Content /> Source If you are using InnerBlocks in a dynamic block you will need to save the InnerBlocks in the save … Read more

Create a custom render Appender button to add Inner Blocks

So I’m answering the following: How to open the block picker menu via a custom button. I.e. Without using InnerBlocks.ButtonBlockAppender. 🙂 How can I open the Block Picker Menu on click of the custom button? There’s no (as of writing) “standard” function (like alert()) that you can simply call which then opens the block picker … Read more

Pre-set CSS class into custom block/template

In case anyone is looking for an answer to this that doesn’t involve adding a filter and a bunch of extra code, you can add a className to the block directly in the template code. This is the same code that the OP used, with one small adjustment. “class” becomes “className”: function myplugin_register_book_post_type() { $args … Read more

Add a button to the toolbar of an existing Gutenberg block

Edit: WordPress 5.9 or above. WordPress 5.9 moved the slotfill behind the useDisplayBlockControls hook which prevents fills from registering unless they are within the currently selected block’s component. It is no longer possible to use the BlockControls slotfill for adding elements to toolbars of WordPress core blocks. Original: WordPress 5.8.3 or below. There is an … Read more

srcset attribute in Gutenberg gallery blocks

Unfortunately, setting the sizes based on the viewpoint size in the Gallery Block isn’t possible as of this writing (quite frustrating, imho) :/ There’s a couple outstanding tickets about this, notably: https://github.com/WordPress/gutenberg/issues/9620 and https://github.com/WordPress/gutenberg/issues/13842