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!