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