Support » Plugin: Simple Locator » Possible to search distance between posts & user?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Kyle Phillips


    Couple things… may not be the best plugin in your case.

    1. If you’re using the ACF Google Map field, it stores the latitude & longitude in a single field as an array. Simple Locator isn’t compatible with that specific field type for that reason.

    2. Currently only post types are supported, not custom user meta.

    I’ve been looking for a way to add support for the ACF Google Map field, just haven’t found it due to the way it stores its data.

    I’m in this situation too.. debating how to move forward.

    Considering creating an acf/save_post function to save the values in the ACF array to new, separate custom fields.

    That might be a way to support ACF if that filter was included in the plugin. This project is so heavily based on ACF (Pro) that I’m not comfortable adding a separate plugin in to handle custom fields for half the data.. but the map/locator stuff would be a great addition if it could work.

    Got it working.. awesome.

     * Save ACF Google Map field to separate coordinate fields for Simple Locator plugin
     * @uses Advanced Custom Fields Pro
     * @author Mike Hemberger
    add_action( 'acf/save_post', 'tsm_save_location_to_separate_coordinates', 10 );
    function tsm_save_location_to_separate_coordinates( $post_id ) {
    	// Bail early if no ACF data
    	if( empty($_POST['acf']) ) {
    	// ACF Google Map field key
    	$location = $_POST['acf']['field_5512f75d518d8'];
    	// Bail if address field is empty
    	if ( empty($location) ) {
    	// Lattitude
    	$latitude  = $location['lat'];
    	// Longitude
    	$longitude = $location['lng'];
    	// Add the coordinates from ACF to separate fields
    	update_post_meta( $post_id, 'my_custom_latitude', $latitude );
    	update_post_meta( $post_id, 'my_custom_longitude', $longitude );
    Plugin Author Kyle Phillips


    @jivedig, that’s a great solution. Thanks for posting. I may try working something like that into the plugin core/options.

    Oh nice, just what I was looking for 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Possible to search distance between posts & user?’ is closed to new replies.