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!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 21, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.