Closed Cyrille37 closed 4 years ago
Hi, You're welcome :)
As the field does not only return one lng/lat, it would be quite a hazzle to save the geo coordinates in a separate post meta. Which one should be saved ... the map position? the first marker? the nth marker? How to name the postmeta? What if naming conflicts arise?
You can easily hook into acf/update_value/?type=open_street_map
and save your additional post meta there.
Something like this should do it (untested):
add_filter('acf/update_value/?type=open_street_map', function( $value, $post_id, $field ) {
update_post_meta($post_id,'a_very_cool_metakey_lat', $value['lat'] );
update_post_meta($post_id,'a_very_cool_metakey_lng', $value['lng'] );
return $value;
}, 10, 3);
@see https://www.advancedcustomfields.com/resources/acf-update_value/
You can easily hook into
acf/update_value/?type=open_street_map
and save your additional post meta there.
Yeah! That's the right way, thanks :-)
Hi, Thanks a lot for that really great plugin.
To make possible searching a post in a bounding box (BBox) we need 2 others post_meta, one for longitude, one for latitude.
What's your opinion ? How do you do for that case ?
Regards.