Support

Account

Home Forums Backend Issues (wp-admin) Trouble updating repeater field values from a custom plugin Reply To: Trouble updating repeater field values from a custom plugin

  • If you know all of the values then it is easier to update the repeater rather than each sub field.

    You may also be running into an issue with using field names VS field keys. When updating ACF fields when they do not already exist in the DB you need to use the field key.

    To update a repeater in one go.

    
    // making up field keys
    // you need to get the correct ones for your fields
    
    // construct an array for the repeater
    $value = array(
      // one nested array for each row
      array(
        // field key => value pairs
        'field_123456' => 'value',
        'field_234567' => 'value',
        // etc
      ),
    );
    
    update_field('field_987654', $value, $post_id);