Home › Forums › Front-end Issues › Update parent and child repeater programmatically › Reply To: Update parent and child repeater programmatically
From what I can see you are updating a subfield for a repeater that does not exist yet and then you’r updating the repeater with empty information except for the title.
When updating a repeater field the value $data
should be a multidimensional array.
$data = array(
// array element for each row
array(
// an element for each field
// since field does not exist always use field keys
'field_123345' => 'value for field 1',
'field_234567' => 'value for field 2',
'field_456789' => 'value for field 3',
// etc...
),
array(
// an element for each field
// since field does not exist always use field keys
'field_123345' => 'value for field 1',
'field_234567' => 'value for field 2',
'field_456789' => 'value for field 3',
// etc...
)
);
update_field('field_key_for_repeater', $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.