Insert block programmatically to a page thanks to its id
-
I am doing a theme. When admin chooses a services page (page that displays all services) from the existing pages on the site, I want to programmatically insert a block “services” on this page thanks to the id of the page.
let block = wp.blocks.createBlock( 'core/paragraph', { content: 'test' } ); wp.data.dispatch( 'core/editor' ).insertBlocks( block );
The code above is interesting, but that insert a block on the current page, while I wish on another page thanks to its id
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Insert block programmatically to a page thanks to its id’ is closed to new replies.