• I have two blocks parent and child. I would like to create variation of both of them (parentV and childV) and have the childV as inner block of the parentV. But when I try it with registerBlockVariation() I am getting error, that childV does not exists. Is there something special I need to do for childV variation registration.

    Example what I have

    {
      "name": "child",
      "title": "Child",
      "parent": ["parent"]
    }
    
    {
      "name": "parent",
      "title": "Parent"
    }

    Parent has the child in allowedBlocks.

    Then I have TS

    domReady( function () {
      registerBlockVariation( 'child',
        {
          name: 'childV',
          title: 'ChildV',
          attributes: {
            className: 'child-v',
          },
        }
      );
    
      registerBlockVariation( 'parent',
        {
          name: 'parentV',
          title: 'Parent V',
          attributes: {
            className: 'parent-v',
          },
          innerBlocks: [
            {
              name: 'childV',
            },
          ],
        }
      );
    });
    
    • Am I missing something?
    • Is it event possible to create variations like this?

    Thank you for help 🙂

The topic ‘WordPress nested block variation’ is closed to new replies.