Home › Forums › Front-end Issues › WP Query closest locations by ACF Google Map values › Reply To: WP Query closest locations by ACF Google Map values
@mastababa If this needed to be done for thousands of locations what I would do would be to create an action that started a CRON job that would do all of the cacluations. I would likely create some type of complex array of data that would store all of the needed information to allow for easy retrieval of the information. How that might look would depend on what I wanted to do.
Let’s say that I wanted to do what the OP was doing and show the closes 3 other locations. My array would probably look like this.
$option = array(
// each element of this array is a post ID => array of closest 3 posts
1234 => array(1567, 7657, 5654),
// etc
)
You can then just grab the post ID’s to get from this array.
Doing the CRON that does all the indexing would be beyond my ability to help here.
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.