Home Forums Gutenberg Gutenberg Parent/Child Blocks


Gutenberg Parent/Child Blocks

  • Hi!

    Loving the ACF Gutenberg Beta so far!

    I am using a nested block approach to create a better grid for a boilerplate theme. I have created a block (via a plugin, the WP way – not ACF) called “Row” that will set an outer wrapper for other blocks (have added the <InnerBlocks /> to this block). Using the allowedBlocks parameter, I can specify all of the core blocks that are allowed in my “Row” block. This is all excellent so far…

    As I create new ACF blocks, I don’t want to have to edit the plugin to add the ACF blocks to the plugin because the ACF blocks will differ between my projects. Gutenberg allows for a “parent” to be specified in a new block. This makes it so that the child block will be allowed in the parent block without specifically adding the new block to the list of allowedBlocks.

    My question: is it possible to add a “parent” parameter to the acf_register_block function? Similar to the other parameters like “name”, “title”, etc?

    I realize this is similar to another topic already posted (link below), but not quite. I am creating the wrapper natively via a plugin. I’m just looking for the addition of a parent parameter.

  • I have made a change to the ACF plugin to accomplish this – perhaps I need to submit as a Git Issue/PR?

    In any case – in blocks.php in ACF, line 88 validate_block_type – I added an additional parameter to $block array and was successfully able to pass it along via the acf_register_block function.
    'parent' => ''

  • Are you able to share that plugin? I’d love to see it. I’m looking for a lightweight plugin with JUST a row/section/container/wrapper block, as you describe it, and I can’t find one!


  • @alicam unfortunately I’m not able to share the plugin at this time (it’s for my job).

    The plugin, at the moment, is just a native Gutenberg block called “Row”. I created it following this tutorial for making a nested block. It’s essentially just a wrapper div with the <InnerBlock> inside of it. Sorry I can’t be more helpful!

  • Did you ever solve this? I need this feature too! Thanks! <3

  • @jrisum no, we never got anywhere with this. Just the plugin code change I mentioned – and we haven’t upgraded the plugin since the beta version.

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Gutenberg Parent/Child Blocks’ is closed to new replies.