Support Log in
All Features of Field Forge

Repeater Fields — Dynamic Row-Based Fields

Repeater fields are the workhorse of custom WordPress development. Team members, FAQ items, product features, testimonials, pricing tiers, social profiles — anywhere you need multiple similar records on a single post, a repeater field is the right tool. Field Forge’s repeater works with the same have_rows() / the_sub_field() loop syntax.


What a repeater field does

A repeater field is a row template. You define which sub-fields each row contains (for example: Name, Photo, Bio), and editors can add, remove, and reorder rows at will. The plugin sets no limit on the number of rows in a repeater field.

Example use case: team members

A field group for a “team page” contains a Team Members repeater with three sub-fields:

  • Name (Text)
  • Photo (Image)
  • Bio (Textarea)

On the post edit screen, an editor clicks “Add Row,” fills in the three sub-fields, and clicks “Add Row” again for the next team member. They can drag rows to reorder, delete individual rows, and add as many rows as needed.


Supported sub-field types

The field group editor offers these types for a Repeater sub-field: Text, Textarea, Number, Email, URL, Link, Image, File, WYSIWYG Editor, Select, Checkbox, Radio Button, Button Group, True / False, Date Picker, Color Picker, Google Map, Gallery, oEmbed, Relationship, Post Object, Page Link, Taxonomy, Group, Repeater, Flexible Content and Calculation. It does not offer Range, Password, User, Time Picker, Tab, Accordion, Message or Clone.

The post editor draws a sub-field with a simpler input than the same field has outside a Repeater. Textarea, WYSIWYG Editor, Image, File, Google Map, Link, Page Link, Post Object and Calculation have their own input, and Group, Repeater and Flexible Content are drawn as nested fields. Every other type is drawn as a plain text input, including Number, Email, URL, True / False, Date Picker, Color Picker, Gallery, oEmbed, Relationship and Taxonomy. The exception is a Select, Checkbox, Radio Button or Button Group sub-field that has Choices entered in the field group editor: it is drawn from its choices, as the same field is outside a Repeater. With no Choices entered it is a plain text input in which the editor types the value. A Placeholder entered for a Text, Textarea, Number, Email or URL sub-field is shown in its empty input. A Text or Textarea sub-field with a Character limit stops at the limit, and a text over it is not saved: the Repeater keeps its old rows and a notice names the field.

The Default and Required settings of a Repeater sub-field have no effect in the post editor: a cell is not filled from the default value and carries no required marker.


Nested repeaters

Repeaters can contain other repeaters. Example: a “services” repeater where each service has a nested “features” repeater.

Services Repeater
├── Row 1: Service A
│   ├── Service Name: "Consulting"
│   ├── Description: "..."
│   └── Features Repeater
│       ├── Row 1: "Discovery workshop"
│       ├── Row 2: "Strategy doc"
│       └── Row 3: "Implementation support"
└── Row 2: Service B
    ├── Service Name: "Development"
    ├── Description: "..."
    └── Features Repeater
        ├── Row 1: "Custom code"
        └── Row 2: "QA testing"

The field group editor offers a list of nested sub-fields for a Group or Repeater sub-field only down to a fixed depth. For deeply nested data you may want to consider restructuring with custom post types and relationships.


Template code (ACF-compatible)

Field Forge’s repeater uses the exact same template functions as ACF and SCF. Code written for ACF works unchanged:

<?php if (have_rows('team_members')) : ?>
  <div class="team-grid">
    <?php while (have_rows('team_members')) : the_row(); ?>
      <div class="team-member">
        <?php
          $photo = get_sub_field('photo');
          $name = get_sub_field('name');
          $bio = get_sub_field('bio');
        ?>
        <img src="<?php echo esc_url($photo['url']); ?>" alt="<?php echo esc_attr($name); ?>">
        <h3><?php echo esc_html($name); ?></h3>
        <p><?php echo esc_html($bio); ?></p>
      </div>
    <?php endwhile; ?>
  </div>
<?php endif; ?>

This code works on:

  • ACF (original)
  • Secure Custom Fields (SCF)
  • Field Forge (with the ACF compatibility layer)

If you migrate from ACF or SCF to Field Forge, this template code stays unchanged.


Nested loops

For nested repeaters, you loop inside another loop:

<?php if (have_rows('services')) : ?>
  <?php while (have_rows('services')) : the_row(); ?>
    <section>
      <h2><?php the_sub_field('service_name'); ?></h2>

      <?php if (have_rows('features')) : ?>
        <ul>
          <?php while (have_rows('features')) : the_row(); ?>
            <li><?php the_sub_field('feature_text'); ?></li>
          <?php endwhile; ?>
        </ul>
      <?php endif; ?>
    </section>
  <?php endwhile; ?>
<?php endif; ?>

Inside the outer loop, have_rows(), the_row() and get_sub_field() read the rows of the inner repeater that belong to the current row of the outer one, as in this example.


Repeater settings

When configuring a repeater in Field Forge’s visual builder:

  • Labelwhat editors see in the post editor
  • Namethe variable name (get_field('name'))
  • Sub Fieldsthe fields of one row, added with the + Add Sub Field button

The field group editor has no input for minimum rows, maximum rows, the text of the add button, the layout or a collapsed row title. A new Repeater stores min and max as 0 and layout as table, and a Repeater made by the ACF import can carry its own values, but the post editor does not read min, max or layout: it does not limit the number of rows, and rows do not collapse. The add button reads Add Row; a field imported from ACF or made by the AI field group generator can carry another button text.


How a repeater is stored

Field Forge keeps a repeater in its own table, fieldforge_values (with the default prefix, wp_fieldforge_values). Field Forge writes one record per sub-field per row, plus one record for the repeater itself that holds the number of rows. Each row record carries the columns parent_id (the record of the repeater) and row_index (the position of the row), and the table has an index on those two columns.

To read a repeater that has no repeater inside it, Field Forge runs two queries on that table: one for the record of the repeater and one for all its rows, in row order.


Migrating existing repeater data

When you import from ACF or SCF with the Pro add-on active, the value import reads the row count of each repeater and the value of each sub-field from the post meta table that ACF used, and writes them to the Field Forge table. A repeater inside a repeater row is copied the same way: the importer reads its row count from the ACF meta key of that outer row and stores its rows under its own record, which belongs to the outer repeater. After migration, your templates keep working through the ACF compatibility layer.

See the migration guide →


REST API output

Field Forge shows repeater data in two places on the WordPress REST API:

  • GET /wp-json/fieldforge/v1/fields/{post_id} returns the field values of a post. It needs a logged-in user who can read that post.
  • The fieldforge property of a post in the standard wp/v2 routes holds only the fields that are marked show_in_rest, and for a repeater its sub-fields must be marked too. The field group editor has no input for that mark; a field gets it from its definition or from the fieldforge/rest/public_field_allowed filter.

The first route returns this for the team members example. An Image sub-field with the default return format is an object with ID, url, width, height, alt (the alt text of the image in the media library) and title:

{
  "team_members": [
    {
      "name": "Alice Johnson",
      "photo": {
        "ID": 123,
        "url": "https://example.com/alice.jpg",
        "width": 800,
        "height": 800,
        "alt": "Alice Johnson",
        "title": "alice"
      },
      "bio": "Alice is our head of engineering..."
    },
    {
      "name": "Bob Smith",
      "photo": { "ID": 124, "url": "...", "width": 800, "height": 800, "alt": "Bob Smith", "title": "bob" },
      "bio": "Bob leads the design team..."
    }
  ]
}

The same structure can feed a headless WordPress frontend. Combined with Field Forge’s TypeScript generation, repeater data becomes a typed array of rows on the frontend.


Ready to use repeater fields?

See pricing →

Repeater fields are a Pro compound type, included in every paid plan — with no limit on the number of rows, and with nested repeaters.

Forge AI Assistant Online

Hi! I'm the Field Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs