Support

Account

Home Forums General Issues How can I update one acf value with another on save? Reply To: How can I update one acf value with another on save?

  • I don’t get the documentation for acf/update_field() either. It says the $field parameter is the field array containing all settings. All the settings of what? The field I want to collect data from? In that case it seems this should work but it doesn’t.

    
    function save_updated_acf_fields($location)
    {
        // Collect GM field data
        $location = get_field('field_634147f894e08', $post_id);
        $gmap_street_name = $location['street_name'];
        $gmap_street_nbr = $location['street_number'];
    
        // Fields retrieving updated values
        $empty_street_name = get_field('field_6341483d94e09', $post_id);
        $empty_street_nbr = get_field('field_634151528a090', $post_id);
    
        if ($location) {
            $empty_street_name = $gmap_street_name;
            $empty_street_nbr = $gmap_street_nbr;
        }
    }
    
    add_filter('acf/update_field ', 'save_updated_acf_fields', 10, 1);
    

    Would you please translate the documentation into something a plain dummy like myself can understand?