Looping Through ACF Repeater Fields

Trying to loop through Advanced Custom Fields’ (ACF) repeater fields? This quick guide will show you how to output the plugin’s results.

Understanding WordPress loops

Loops are a big part of WordPress. Loops are how WordPress runs through pages, posts and custom post types. You can use the PHP while function to loop through these.

Using while loops with the ACF repeater field

  1. Create a repeater field in ACF;
  2. Add subfields to your repeater;
  3. Use the PHP code below and adapt this to your repeater’s name and subfields.
while ( have_rows ( 'repeater_name' ) ) : the_row()
 echo get_sub_field( 'first_subfield_name' );
 echo get_sub_field( 'second_subfield_name' );