Home Forums Add-ons Repeater Field Use InnerBlocks inside Repeater field


Use InnerBlocks inside Repeater field

  • Is there a way to use InnerBlocks inside a repeater?
    In my example, I have tabs and I want to use InnerBlocks as the tab content.
    If I use InnerBlocks inside the repeater loop it duplicates the content to all tabs.

  • I believe I’m right in saying that you can only include the <InnerBlocks /> tag once per block, so it wouldn’t really working in the repeater situation.

    However, I believe you can still get the desired result with a slightly different approach. You’ll just need to use two custom blocks instead.

    The first block, “tab group”, will look something like this:

    <div class="group"> <InnerBlocks /> </div>

    The second block, “tab item”, will look something like this:

    <div class="item"> <InnerBlock /> </div>

    The key is when you set the “tab group” block up that you define 'allowed_blocks' to only allow “tab item” (acf/tab-item). Also, you can set the “tab item” up with 'parent' to only allow it as an option when inside a “tab group”. Now, when you’re in the editor, you can firstly create a group block and then add as many unique item blocks to the group. Basically the same as a repeater!

  • Any plans on implementing it in a later release? Anyone know something? This feature would be great!

  • Hi! Having same “problem” here, this feature would be really great!

    Is there any issue open?

    Thanks in advance.

  • Doesn’t @dsouzaj86 ‘s answer solve this?

    It isn’t a limitation of ACF, but of Gutenberg at this point. You can only have 1 <InnerBlocks /> within a block.

    It seems like the solution suggestion is the exact way of working around this with ACF.

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.