-
Hi,
I’m having trouble referencing a ACF repeater for the new Query block.
I have a repeater on the main level, and because I have a repeater inside another repeater I thought making a new Query block would work , but I’m struggling to get the content showing.
Can I get some assistance with this please?
-
Alvind
Hi there,
Can you provide a temporary admin login for your staging site so we can take a closer look and conduct some testing? I don’t have ACF Pro to test the Repeater field, but I assume it should work the same way as querying an ACF Group field.
-
Hey, sorry I missed your response. Check the private information
-
Alvind
I was trying to check the page, but it seems like you’re currently editing it. Please let us know when you’re finished so we can take a look.
-
Anonymous
You can take over. I changed the layout slightly from how it’s positined. but nothing else is different to how I am querying it
-
Updated priv info
-
Alvind
Okay, it seems like a nested repeater might not be supported in the query block at the moment. Just for the sake of testing, could you replace the Product Features repeater field with a Group field and see if the query loop—set to query the nested repeater—then works?
-
I copied it, got rid of the parent query loop as the Group type is not an array, and it works now
So it seems if you put in a nested Query Loop, it doesn’t work.
-
I found a fix for it:
Instead of adding a nested Query block inside the parent Query block referencing the nested ACF Repeater Field since it doesn’t work, I’ve instead made multiple Text blocks that then indexes the nested repeater array like this:
{{loop_item key:product_features.0.feature}}An example JSON of what the ACF fields look like is:
{ "acf": { "product_card": [ { "product_name": "Name", "product_description": "Description", "product_features": [{ feature: "Feature 1" }, { feature: "Feature 2" }] } ] } }It would be great though if GB 2.0 could support nested repeaters, as there are use cases where an ACF repeater field could have another ACF repeater field inside of the array. I think there is a bug with how GB handles arrays and it might not detect an array inside an array if that makes sense.
-
Alvind
Thank you for sharing the fix!
I agree that there are still a few issues with the Query Block regarding the nested repeater fields. I will forward this to our development team for their review.
Since we’re about to release the official 2.0 version, any possible fixes will likely come in a later patch release.
-
Thanks a lot.
-
Alvind
You’re welcome!
- The topic ‘Trouble Accessing ACF Repeater in a Repeater with a Query Block’ is closed to new replies.