Home › Forums › ACF PRO › Google Map Field (Pro) › Reply To: Google Map Field (Pro)
UPDATE
So, using the code below, I can extract the lat/lng from the data and populate two new acf fields.
function rhm_update_latlon($post_id, $post, $update) {
$map = get_post_meta($post_id, 'address', true);
if (!empty($map)) {
update_post_meta( $post_id, 'lat', $map['lat'] );
update_post_meta( $post_id, 'lng', $map['lng'] );
}
}
add_action('save_post', 'rhm_update_latlon', 90, 3);
Now, how can I use this to create some kind of ‘nearest 3 schools’ query based on the school they are viewing?
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.