Home › Forums › ACF PRO › have_rows causing infinite loop when getting repeater values from another page › Reply To: have_rows causing infinite loop when getting repeater values from another page
I love recursive code, but I have to tell you that this is recursive in a way the makes my head hurt just a bit.
While I was looking at it and trying to figure out how to make it into a single recursive function that would be easier to follow I noticed that the block_id
is a text field and it represents a post ID
and I’m pretty sure that it needs to be an integer. It’s a stab in the dark but try changing to this
$target_page = intval(get_sub_field('target_page'));
If that doesn’t do it I’d suggest trying to turn this into a recursive function, there could be a problem with using different template parts.
Also, I don’t see any way that it can stop if the pages reference each other back and forth, which is another reason I would suggest using a recursive function. It would make it easier to add a safety switch, some type of check to make sure you are not looping forever because of what’s been entered.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.