get used blocks in post and detect changing

You can access the blocks used in the post in js using getBlocks(): wp.data.select( ‘core/block-editor’ ).getBlocks(); In terms of updating on changes – the editor saves all it’s data in a store, so you would want to subscribe and react based on what changes you need to react to. As an example: ( () => … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)