Support

Account

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