I am looking for a solution to query nearby locations based on a given lat and lng value, using ACF maps field. All I currently have is a lat and lng search value (that I want to use to search for nearby locations) and I know that ACF is storing the lat/lng info for each location in a array, that can be obtained by
<?php
$google_map = get_field('adres');
$lat = $google_map['lat'];
$lng = $google_map['lng'];
?>
How can I query through the posts (of a CPT ‘locations’) and only show locations that are nearby(based on a radius) a given lat and lng?
I did find this answer https://wordpress.stackexchange.com/a/372020/124244, but I really don’t know what to do here to make it work with ACF.
Any help is greatly appreciated, thanks a million!