Home Forums Add-ons Repeater Field Repeater field returns nothing from a Template Reply To: Repeater field returns nothing from a Template

  • Your main loop starts with this line

    <?php while ( have_posts() ) : the_post(); ?>

    and ends with the matching

    <?php endwhile; // end of the loop. ?>

    Your problem is that most of your calls get_field() and other ACF functions is outside the loop, so the current $post->ID value may or may not be used. If you use ACF functions outside of "The Loop" then you must supply the post ID when calling ACF functions. Not using adding the post ID outside the loop will have unpredictable results.

    You can get the current post ID outside of the loop using

    $post_id = 0;
    $queried_object = get_queried_object();
    if (isset($queried_object->ID)) {
      $post_id = $queried_object->ID
    $post_id = $queried_object->ID;

    then call ACF functions like

    $value = get_field('my_field_name', $post_id);