ACF (Advanced Custom Fields) is a very capable plugin for WordPress.

I would rank it at the top of my go to list of plugins for doing geeky things with WordPress. I do however sometimes struggle with it’s repeater field. The repeater field is used for adding tabular data (or lists) to posts. The number of items in a repeater field can be unlimited and it basically works on arrays.

The correct way for programmatically adding data into a repeater field is to use the update_field function. I find however the docs on doing this a little vague.

This is the array the repeater field expects to see

$value = array(
  // nested for each row
    // field key => value pairs
    'field_59606dc9525dc' => 'value for row 1'
    // field key => value pairs
    'field_59606dc9525dc' => 'value for row 2'

Here is the right way to do it

foreach ($wpbb_xml_params->features->children() as $second_gen) {
    $feature_value = (string)$second_gen;
    $value[] = array( 'field_59606dc9525dc' => $feature_value );
update_field( 'field_59606db8525db', $value, $wpbb_job_post_id );