admin管理员组

文章数量:1122846

Is there a way of preventing the use of a certain block variation inside a specific parent block?

I have an "inner blocks" block that is basically a group block but without any settings, it's just a container for inner blocks. I have another block that is almost the same thing except it has one attribute. I would like to just use the first block, and add the second as a variation, but only allow the variation to be used inside one specific parent block.

Is this doable?

Is there a way of preventing the use of a certain block variation inside a specific parent block?

I have an "inner blocks" block that is basically a group block but without any settings, it's just a container for inner blocks. I have another block that is almost the same thing except it has one attribute. I would like to just use the first block, and add the second as a variation, but only allow the variation to be used inside one specific parent block.

Is this doable?

Share Improve this question asked Sep 11, 2023 at 12:46 Markus FinellMarkus Finell 1212 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

A variation is a representation of the original block.


if block-1 allows the insertion of block-2; then block-1 will except all variations of block-2.


core/columns only allows the insertion of a core/column.

  • If I create a variation of core/column I would expect the core/column to accept my variation.
  • And therefor the reverse should also to be expected.

but… block.json offers the blockHook key which might offer a workaround of sorts

"blockHooks": {
        "acme/dialog": "firstChild"
    }

P.S. This answer by Tom J Nowell goes into additional aspects and is quite enlightening

本文标签: Prevent block variation inside certain parent blocks