Home › Forums › Front-end Issues › update_field() assigns value but doesn't display on frontend › Reply To: update_field() assigns value but doesn't display on frontend
If you are updating a sub field of another field then you need to supply an array when updating the field.
Assuming that you are using a group field due to the lack of index values between “parent_field” and “sub_field”. If it’s not a group field and you’re using a repeater let me know and I will give you the correct array structure for repeaters.
$value = array(
// subfield key => value pairs
'field_XXXXX' => 'value',
'field_YYYYY' => 'value'
)
// where field_AAAAA is the parent field
update_field('field_AAAAAA', $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.