Support

Account

Home Forums Front-end Issues update_field on hook or click?

Unread

update_field on hook or click?

  • Hello, I have the following code:

    $repeater = get_field('itinerary');
        $count = count($repeater);
        for($i = 0; $i < $days; $i++) {
        $field_key = "field_5ee8665e2cd7f";
        $value = get_field($field_key);
        $value[] = array("testing" => "$array[$i]");
        update_field( $field_key, $value ); }

    Which basically loops through a dynamic variable ($days) and then sets the value of that field to the corresponding number in an array.

    This works well, but I need to force refresh the page in order to see it. How do I attach this code to the update of the front end form?

    Thanks!

Viewing 1 post (of 1 total)

The topic ‘update_field on hook or click?’ is closed to new replies.