Hi,
I’m having some issues with the ACF Google Map field.
My first question is what is the database table ‘acf_google_map_search_geodata’ that is created actually used for? I’ve created several posts (custom post type ‘school’) and all data is saved in to the postmeta table, so what is the ‘acf_google_map_search_geodata’ for?
My end goal is to create some kind of query that displays the 3/4 nearest schools to the current school by lat/lng, which should be possible as all this data is available for each post.
The solution here seemed encouraging, but the last ‘working’ example was from 2018 and I can’t make this work.
Can anyone offer any advice on this?
TIA x
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?
Is Google Map Field (Pro) another plugin? ACF does not create any extra tables for storing data. If this table is created in relation to an ACF field then something other and ACF is doing it. If this is the case then your question should be submitted to the developer of that plugin.
You referenced a table
My first question is what is the database table ‘acf_google_map_search_geodata’
ACF does not create any database tables
You must be logged in to reply to this topic.
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.