Support

Account

Home Forums Front-end Issues updating Google Map field with update_field

Solving

updating Google Map field with update_field

  • I’m working to update the Google map field via an external form, but I haven’t been able to figure out the correct format. I currently have something similar to this:

    
    $postID = 50;
    $field_key = "map_location";
    $value = [address => 123 Somewhere Dr. Anywhere, AK 3834 USA, lng => 32.9403, lat => 64.9403];
    
    update_field($field_key,$value,$postID);
    

    What is the correct format for $value?
    Thanks in Advance

  • I had to write a converter script to update some fields and this is how I set up the Google map field $value array. Worked fine.

    
    $field_name = "field_53bdd058c84a8";
    $value = array("address" => $address, "lat" => $lat, "lng" => $lng, "zoom" => $zoom);
    update_field($field_name, $value, $this_ID);
    
  • Just to share, if anyone having a problem with WP All Import plugin and Google Maps filed, the above solution works well.

    I had an issue with WPAI saving the address, lat and lng but the posts were not coming up in WP_Query. Using the code shared by Yiorgos Theo worked.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘updating Google Map field with update_field’ is closed to new replies.