Home › Forums › Front-end Issues › Checking custom posts in repeater loop breaks the repeater › Reply To: Checking custom posts in repeater loop breaks the repeater
Your problem is that you have multiple nested queries.
when you use wp_reset_postdata() at the end of the $adloop loop WP is resetting to the post in the main query, not the post in the $scheduleloop query. This function always resets to the main query.
You can try
But I do not think this will work because $scheduleloop will be undefined in the second include.
Even if defined you will have an issue if that template is included from multiple places so you wouldn’t know what query you need to reset. My suggestion here would be to use
get_template_part() instead of
include(locate_template(...)) and pass the query to be reset as an argument.
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!
© 2022 Advanced Custom Fields.