By adding a new post, we have access to all core blocks from the very beginning. I would like to limit this and prevent some core blocks from being used on the main level. They should only be available inside my custom inner block.

I have been given some advice about:

  • using the template with init action
  • using the parent attribute in custom block

but all this does not limit the availability of blocks at the main level

I figured maybe hiding blocks, depending on where the inserter is in the DOM structure might be an idea but I'm not sure it's a good direction.

2 Answers 2


You will need to filter the template for the post type:

add_action( 'init', 'setup_template' );

function setup_template() {
    $post_object = get_post_type_object( 'post' );
    $post_object->template = [ [ 'your/custom/block' ] ];
    $post_object->template_lock = 'all';

This will pre-populate the post with a single instance of your custom block and lock it from being changed.

By locking it, they cannot insert any top-level blocks but can still insert items into your custom block. There is more info in the docs about locking, you may need insert instead of all depending on your intent.

Hope it helps.


If I understand your post correctly, I believe you are looking for ALLOWED_BLOCKS property. Use this in your Inner-blocks in following.

const ALLOWED_BLOCKS = [ 'core/image', 'core/paragraph' ];
    allowedBlocks={ ALLOWED_BLOCKS }

You can find more info here https://developer.wordpress.org/block-editor/tutorials/block-tutorial/nested-blocks-inner-blocks/#allowed-blocks

  • No, you get it wrong. When you adding a new page, you still have access to all the core blocks at the very beginning. They shouldn't be available at first. Access should only be inside my custom block
    – kanlukasz
    Oct 30, 2020 at 12:19

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.