Home Forums ACF PRO Google Map Field (Pro) Reply To: Google Map Field (Pro)


    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?