Allowing core blocks ONLY within custom inner blocks
-
Hi,
For a client website, I created a set of custom Gutenberg blocks with the help of ACF.
I want my client to be able to use a limited selection of core WordPress blocks within these inner blocks. Blocks such like:
– core/paragraph
– core/heading
– core/listHowever, I don’t want these blocks to be available outside of these custom inner blocks. They need to be exclusively available INSIDE these custom inner blocks.
How do I achieve this?
Right now I have disabled all Gutenberg blocks except for these blocks with the following array:
add_filter( 'allowed_block_types', 'ql_allowed_block_types', 10, 2 ); function ql_allowed_block_types( $allowed_blocks, $post ) { $allowed_blocks = array( 'core/heading', 'core/paragraph', 'core/list', "acf/img-text-column", "acf/img-text-row", "acf/text-block", "acf/img-grid", "acf/columns", "acf/button", ); return $allowed_blocks; }
With the acf blocks being my custom blocks.
Here is a screenshot of the blocks in the Gutenberg block menu: https://prnt.sc/1s7znyl
Cheers!
- The topic ‘Allowing core blocks ONLY within custom inner blocks’ is closed to new replies.