Home › Forums › ACF PRO › Search contents by latitutine, longitude and radius › Reply To: Search contents by latitutine, longitude and radius
Hi @frabiacca
ACF saves the google map field in a serialized string like this:
a:3:{s:7:"address";s:47:"399 King St, West Melbourne VIC 3003, Australia";s:3:"lat";s:18:"-37.81093672361003";s:3:"lng";s:18:"144.95318412780762";}
To get the nearest location based on the lat/lng, I believe you need more than wp_query. You can use the wpdb class to query do the query and calculation, but it’s not an easy task. Please take a look at this thread to learn more about the calculation: http://stackoverflow.com/questions/11112926/how-to-find-nearest-location-using-latitude-and-longitude-from-sql-database.
If you don’t understand it, I suggest you hire a developer to help you out with it, and I’d recommend looking for one on https://studio.envato.com/ or https://www.upwork.com/.
I hope this helps.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.