Adds a new row of data to an existing Repeater or Flexible Content field value.


add_row($selector, $value, [$post_id])
  • $selector (string) (Required) The field name or field key.
  • $value (array) (Required) The new row data.
  • $post_id (mixed) (Optional) The post ID where the value is saved. Defaults to the current post.


(int|false) The new total row count on successful update, false on failure.

Change Log

  • Added in version 5.3.2


Add a new row using field names

This example shows how to add a new row of data to an existing repeater field called ‘images’. This repeater field contains 3 sub fields (‘image’, ‘alt’, ‘link’).

$row = array(
    'image' => 123,
    'alt'   => 'Another great sunset',
    'link'  => ''

add_row('images', $row);

Add a new row using field keys

This example demonstrates how to add a new row of data to an existing repeater field using keys instead of names. The repeater field is the same above. Similar to the update_field() function, using a field’s key rather than its name allows ACF to correctly find the field if no existing value has been saved.

$row = array(
    'field_560389746a525'   => 123,
    'field_560389746a524'   => 'Another great sunset',
    'field_560389746a528'   => ''
add_row('field_560389746a51f', $row);

Black Friday Sale 🎉 Get 30% off new licenses and 15% off early renewals!
Coupon expires Dec 1st (11:59pm GMT) - don't miss out!

* Discounted subscriptions will renew at their full price. Cancel at any time.

Coupon Code

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.