TechEarl

Why Your First ACF Repeater Row Appears Empty

An ACF Repeater where the first row's data looks blank is almost always one of three things: missing the_row(), incorrect sub-field name, or accidental data overwrite via update_field with the wrong field reference.

Ishan Karunaratne⏱️ 5 min readUpdated
Share thisCopied
ACF Repeater first row appears blank? Three causes: missing the_row, incorrect sub-field name, accidental data overwrite. Real fixes with code examples.

A Repeater field where the first row's data appears blank (but subsequent rows render fine) is one of the more confusing ACF symptoms. It usually traces to one of three causes. After years of running directory sites with Repeater fields holding thousands of rows, I have seen this exact pattern often enough to diagnose it in seconds.

Jump to:

Cause 1: Missing the_row() inside the loop

The most common cause. The Repeater loop pattern requires the_row() as the first call inside while ( have_rows() ). Without it, the internal row pointer never advances, so get_sub_field() reads from "no row" rather than from the first row.

php
// Broken: no the_row()
if ( have_rows( 'team_members' ) ) {
    while ( have_rows( 'team_members' ) ) {
        $name = get_sub_field( 'name' ); // always empty
        $role = get_sub_field( 'role' );
        echo "<li>$name ($role)</li>";
    }
}

// Correct
if ( have_rows( 'team_members' ) ) {
    while ( have_rows( 'team_members' ) ) {
        the_row();
        $name = get_sub_field( 'name' );
        $role = get_sub_field( 'role' );
        echo "<li>$name ($role)</li>";
    }
}

Symptom in this case: every row appears empty, not just the first. If your first row renders empty but rows 2+ render correctly, this is not your bug. If all rows are empty, it almost certainly is.

Cause 2: Loop reads wrong sub-field on iteration zero

This is the "specifically first row is empty" symptom. It happens when code outside the loop has already started consuming a row, and the loop is effectively starting from row 2.

php
// Subtle bug
the_row( 'team_members' ); // advances the pointer outside the loop
if ( have_rows( 'team_members' ) ) {
    while ( have_rows( 'team_members' ) ) {
        the_row(); // now on row 2
        echo get_sub_field( 'name' );
    }
}

The standalone the_row( 'team_members' ) call before the loop consumed row 1. The while then starts at row 2. The visible symptom is "the first row is missing."

Fix: remove any the_row() calls outside the loop. Use only the canonical if ( have_rows() ) { while ( have_rows() ) { the_row(); ... } } pattern. The standalone the_row() is rarely needed and is the cause of most "first row is empty" tickets I have debugged.

Cause 3: update_field() overwrote the data

A particularly painful version. You have a Repeater with five populated rows. A piece of code (perhaps an acf/save_post hook or a WP-CLI migration script) called update_field( 'team_members', $new_data, $post_id ) with $new_data that was missing the first row, or with sub-field keys that did not match the registration. Result: the first row is overwritten with empty sub-field values, or removed entirely, while rows 2-5 stay intact (if the new data preserved them).

Fix: trace what code is writing to the field. Common culprits:

  • A custom acf/save_post action that rebuilds the Repeater incorrectly.
  • A WP-CLI script with a faulty array shape passed to update_field.
  • A form submission handler that constructed the Repeater data from $_POST without correctly handling the first array index.

Mitigation: in your update code, log the array shape before the write. error_log( wp_json_encode( $new_data ) ) before update_field() makes the debugging tractable. For agency-scale patterns of safe ACF mutations, see Useful Things You Can Do with acf/save_post.

Less common: serialized data corruption

In rare cases, the Repeater meta value in the database becomes corrupted: the count value (e.g., wp_postmeta row where meta_key = team_members and meta_value is the count "5") gets out of sync with the actual sub-field rows. ACF then iterates based on the count and reads sub-fields that have indices that do not align with reality.

Fix:

bash
wp db query "SELECT meta_value FROM wp_postmeta WHERE post_id = 123 AND meta_key = 'team_members'"
wp db query "SELECT meta_key, meta_value FROM wp_postmeta WHERE post_id = 123 AND meta_key LIKE 'team_members_%'"

If the count does not match the number of team_members_N_subfield rows, you have corruption. The simplest fix is to re-save the post through the admin (which makes ACF rewrite all the meta values consistently). For a programmatic fix, write a one-off WP-CLI script that re-reads all the rows, deletes the broken meta, and rewrites it cleanly via update_field( 'team_members', $rows, $post_id ).

I have seen this happen exactly twice in fifteen years, both times after an aborted bulk-import script. It is rare. Eliminate causes 1, 2, and 3 first.

The diagnostic order

When the first ACF Repeater row appears empty:

  1. Confirm whether ALL rows are empty or only row 1. var_dump( get_field( 'team_members', $post_id ) ); shows you the entire stored array. If every row's sub-fields are populated in the dump, the issue is in your template code (Cause 1 or 2). If row 1 specifically is missing sub-field values in the dump, the issue is in the stored data (Cause 3).
  2. If only row 1 is empty in the template but row 1 is populated in the dump: there is a stray the_row() call before your loop, or another loop earlier in the page consumed a row. Search for the_row across the template files.
  3. If row 1 is empty in the dump: trace what code wrote to the field last. update_field calls in acf/save_post, WP-CLI scripts, form handlers. Add logging.
  4. If the counts in wp_postmeta look inconsistent: treat it as data corruption and re-save the post via the admin to let ACF rebuild the meta cleanly.

For AI-assisted debugging of this specifically (where the assistant can read the template code, dump the meta, and walk through which case applies), see Using Claude CLI to Manage WordPress Sites. For the broader pattern of agency-scale ACF debugging, How Small WordPress Agencies Can Use AI in 2026, by Role covers the developer-role workflows.

Sources

Authoritative references this article was fact-checked against.

TagsWordPressACFRepeaterDebugging

Found this useful? Pass it on.

Copied

Ishan Karunaratne

Tech Architect · Software Engineer · AI/DevOps

Tech architect and software engineer with 20+ years building software, Linux systems, and DevOps infrastructure, and lately working AI into the stack. Currently Chief Technology Officer at a healthcare tech startup, which is where most of these field notes come from.

Keep reading

Related posts

Why Your ACF Checkbox Field Returns an Array

ACF Checkbox fields return arrays because they support multiple selections. The shape varies by Return Format. Here's what each option returns, the patterns for rendering and querying, and when to switch to a Select or Radio field instead.

How to Count Rows in an ACF Repeater Field

Counting ACF Repeater rows is three short patterns: count() on the raw field, get_field_count() inside a loop, and a faster meta-only count that skips loading the rows. Each has its right use case.

How to Filter ACF Relationship Fields by Post Type

ACF Relationship fields let editors pick from any post type by default. The Post Type filter in the field group editor restricts the choice list. For dynamic filtering (taxonomy, status, ACF field), the acf/fields/relationship/query filter is the right tool.