1

I'm defining which set of blocks to allow in my custom innerblocks:

const ALLOWED_BLOCKS = [ 'core/image', 'core/paragraph', 'core/group' ];

...

<InnerBlocks allowedBlocks={ ALLOWED_BLOCKS } />;

This seems to work fine. Only image, paragraph, and group blocks are showing as options when trying to insert blocks in my custom innerblocks block.

However the group block also accepts nested blocks. It is not following ALLOWED_BLOCKS and allowing any block to be added.

How can I apply ALLOWED_BLOCKS to blocks that use innerblocks which are added to my custom innerblocks?

1
  • Last time I tested this (~1y ago) it wasn't easily possible. So for that project we only allowed blocks that have no inner blocks or custom versions of group/etc. where we could define the allowedBlocks again.
    – kero
    Nov 10 '21 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.