Support

Account

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