Support

Account

Home Forums Backend Issues (wp-admin) update_field() issues Reply To: update_field() issues

  • Thanks for the input Jonathon. While the code example you provided caused some issues (including an infinite loop when I added the post_id to the have_rows() function!), the field key suggestion was instrumental in solving it. What does work is this:

    if (false == update_sub_field(
        array('repeater_key', 1, 'sub_field_name'), 
        $value, 
        $postId
    )) {
        update_field(
           'repeater_key', 
            array(
                array('sub_field_name' => $value)
            ), 
            $postId
        );
    }

    The difference is using the repeater’s key instead of name in the update functions.