How to lock innerBlocks within a block variation?


I am trying to create a new group block that includes one core/heading block and then one core/gallery block. I do not want editors to be able to add other inner blocks to the group. Nor do I want editors to be able to delete either of the heading or gallery blocks.

Here is my block variation so far:

    wp.blocks.registerBlockVariation("core/group", {
        name: "logo-grid",
        title: "Logo Grid",
        description: "",
        category: "media",
        icon: "smiley",
        scope: ["inserter"],
        attributes: {
        innerBlocks: [
            ["core/heading", { level: 2, placeholder: "Heading" }],

I’ve looked into templateLock and template_lock and lock attributes but none seem to apply to block variations?

I realize I may be using the wrong tool for the job by trying to create a block variation with this functionality. Any advice for how to achieve what I want?

cornelius 12 months 2021-10-14T21:40:24-05:00 0 Answers 0 views 0

Leave an answer