I’m not 100% sure what you should send to update field for a flex field.
I know that for a repeater you can so something like this:
$repeater = array( // nested array for each row array( // element for each field 'field_1234567890' => 'value', ) );
I would definitely use field keys here, especially if you’ll be adding values that don’t exist yet, like the first row.
Most of the time, if you do the following you can see what you need to supply for update_field(). What is returned here usually works in reverse for updating if you replace field names with field keys. But again, I’m not 100% sure on the flex field.
$flex_field = get_field('my_flex_field', false, false); echo '<pre>'; print_r($flex_field); echo '</pre>';
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!