How to Display ACF Repeater Field Values in WordPress

Display Advanced Custom Fields repeater values using have_rows and get_sub_field functions to loop through flexible content rows. Perfect for team listings, FAQs, galleries, or any grouped content. Learn to check for rows with have_rows, iterate with while loop, retrieve subfield values with get_sub_field, and create dynamic structured data displays with ACF repeater fields for powerful content management.

Display Repeater Field Values Using ACF in WordPress

ACF ACF Guide ACF Option Page ACF Tutorials Code Snippets Coding Blog Custom Code Snippets Custom Fields PHP PHP Development Woocommerce Wordpress WordPress Development WordPress Tips

Display Repeater Field Values Using ACF in WordPress Tutorial/Guide

Advanced Custom Fields (ACF) enables you to attach flexible, repeatable field groups to your WordPress posts and pages. One of the standout features is the repeater field. This tutorial explains how to fetch and display repeater field data using have_rows() and the_row().

Fetching Values from ACF Repeater Fields

Let’s say you have a repeater named "my_repeater_field" containing two subfields: "sub_field_1" and "sub_field_2". Here's how you can loop through and display them:

Step 1: Loop Through Repeater Field Rows

Use have_rows() to check for rows before starting the loop:

<?php
if (have_rows('my_repeater_field')) {
    while (have_rows('my_repeater_field')) {
        the_row();
        $sub_field_1_value = get_sub_field('sub_field_1');
        $sub_field_2_value = get_sub_field('sub_field_2');

        echo 'Subfield 1: ' . $sub_field_1_value . '<br>';
        echo 'Subfield 2: ' . $sub_field_2_value . '<br>';
    }
}
?>

Step 2: Get Subfield Values

Inside the loop, use get_sub_field() to pull values from each subfield:

  • get_sub_field('sub_field_1') – returns the value of the first subfield.
  • get_sub_field('sub_field_2') – returns the value of the second subfield.

You can repeat this pattern for more subfields within the repeater group.

Benefits of Repeater Fields

Repeaters are ideal for structured data like team listings, FAQs, or grouped content blocks. With a few lines of code, you can make your site dynamic and manageable.

Further Reading

Now you're ready to leverage ACF repeater fields effectively in your projects!  

๐Ÿ’ก Have a Coding Problem?

Search our archives or reach out to our team for solutions and expert advice.