Support

Account

Home Forums Backend Issues (wp-admin) Field value update using update_field doesn’t show on backend… Reply To: Field value update using update_field doesn’t show on backend…

  • I would give up on updating the row and instead update the entire group field, the only question would be what other fields are in that group. This should work.

    
    // this will hold the value to update the group with
    $group_field_value = array();
    // initialize row value just in case the loop returns noting
    $row = array();
    // loop group field and get existing values
    if (have_rows('field_q3md98zvnm241', $post_id)) {
      while (have_rows('field_q3md98zvnm241', $post_id)) {
        // this loop always happens 1 time for a group field
        // *********************************************************
        // little known fact
        // the_row() returns an array holding the row
        // with field keys as indexes and unformatted field values
        // *********************************************************
        $row = the_row();
      }
    }
    // set a new value for the "owner_name" field by field key
    $row['field_4v8yw6n2hbpqs'] = 'get old value and insert here';
    // update the field
    // update the group field
    update_field('field_q3md98zvnm241', $row, $post_id);