Programmatically add Gutenberg blocks to edit post page
-
Hello,
I want to add some kind of “required blocks” to a custom post type. If they are missing (e.g. if you create a new post, or on save), they should get added to the post, on load before the rendering so it is instantly there.
I’ve tried to add blocks to the Gutenberg editor per php. But I don’t even have found a filter which lets me edit the post content before it gets rendered. But even if there is such a hook, I would need to know the block html markup to add it to the content.
With “has_blocks()” and “parse_blocks()” I way able to check if blocks are missing in the “the_post” action. But how can I get a registered block and add it to the post content – before the post gets rendered in the admin view / Gutenberg Editor?
- The topic ‘Programmatically add Gutenberg blocks to edit post page’ is closed to new replies.