Home › Forums › Add-ons › Repeater Field › Problema withe repeater item › Reply To: Problema withe repeater item
The problem is as I have explained in other places on these forums, and above. You cannot use a nested loop that includes setup_postdata()
and wp_reset_postdata()
. wp_reset_postdata()
ALWAYS resets post data to the main query. In you example there is the “Main WP Query”, then you do a custom query, then you get a post from a field. The last is the 3rd nesting. Calling wp_reset_postdata()
here is what is causing the problem. You must interact with this post in another way, for example
<li class="inline-block">
<?php
$post_object = get_sub_field('shop_sales');
if ($post_object) {
?>
<a class="uppercase" href="territoiredhomme/nos-boutiques/">
<?php echo get_the_title($post_object->ID); ?>
</a>
<?php
}
?>
</li>
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.