This is not supported yet
this is available on version 1.7.ACF LocateAndFilter_pro
for free version
you can import ACF fields into locateandfilter fields
and synchronize locateandfilter and ACF using filter
1 import ACF fields into locateandfilter
eg your post type ‘place’
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$all_places = get_posts(array( 'post_type' => 'place', 'post_status' => 'publish', 'fields' => 'ids', 'posts_per_page' => -1 )); foreach ($all_places as $key => $place_id) { $location = get_field('location', $place_id); $lat = $location['lat']; $lng = $location['lng']; update_post_meta($place_id, 'locate-anything-lat', $lat)[0]; update_post_meta($place_id, 'locate-anything-lon', $lng)[0]; } |
2 synchronize locateandfilter and ACF
eg your ACF field map type https://www.advancedcustomfields.com/resources/google-map/
1 2 3 4 5 6 7 8 9 10 11 |
function acf_set_locateandfilter_lat_lon( $value, $post_id, $field ) { if($value != ''){ $lat = $value['lat']; $lng = $value['lng']; update_post_meta($post_id, 'locate-anything-lat', $lat)[0]; update_post_meta($post_id, 'locate-anything-lon', $lng)[0]; } else { } return $value; } add_filter('acf/update_value/name=location', 'acf_set_locateandfilter_lat_lon', 10, 3); |