Home › Forums › General Issues › Update sub field, then get value › Reply To: Update sub field, then get value
I’ve got the exact same issue here.
I have a update_sub_field
inside a foreach after which I do a get_field
of the repeater right after the update, but it still has the old values even though the update_sub_field
did indeed update everything correctly.
Not sure why ACF get_field
is still getting old values. Thanks for any help!
E.g.
$lists = get_field('lists', $post->ID); // repeater field
foreach ($lists as $key => $list) {
update_sub_field(array('lists', $key, 'field'), 0, $post->ID); // switch from '1' to '0'
}
$lists = get_field('lists', $post->ID);
var_dump($lists);
// outputs old values
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.