Support

Account

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’m not the developer, I just do my best to answer questions here. I can mark this thread for the developer to look at when he get time.

    My suspicion is that it has something to do with a combination of not providing a post id for the repeater and the fact that you’re using get_template_part() which creates a disconnect.

    get_template_part() includes a lot of global variable values so that the template part has access to them, like the current $post and $wp_query. This might have something to do with the post id being reset, this is likely the reason your post id value is being reset.

    You could try using php include instead of get_template_part which would rule this out since the variables will transfer to the included file and won’t be overridden by the global calls in get_template_part.

    But this causes another problem where $target_page and $target_section will be overwritten every time that _block_reference.php is included so you’ll end up with a different problem.

    Like I said above, you’ll either need to do the work around that you outline or create a recursive function that would eliminate both problems.