Last updated Feb 17, 2022


Updates a row of data for an existing Repeater or Flexible Content field value.


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


(bool) True 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 update the first row of data of an existing repeater field called ‘images’. This repeater field contains 3 sub fields (‘image’, ‘alt’, ‘link’). Please see notes regarding index offset.

$row = array(
    'image' => 123,
    'alt'   => 'Another great sunset',
    'link'  => 'http://website.com'

update_row('images', 1, $row);


Index offset

When targeting a specific row number, please note that row numbers begin from 1 and not 0. This means that the first row has an index of 1, the second row has an index of 2, and so on. To begin indexes from 0, please use the row_index_offset setting like so.


add_filter('acf/settings/row_index_offset', '__return_zero');