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);
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.