Home › Forums › Add-ons › Flexible Content Field › Issues with add_rows and flexible content › Reply To: Issues with add_rows and flexible content
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.