Post queries by latitude and longitude

I am struggling with getting post queries by coordinates. I have meta fields map_lat and map_lng for almost all post types. I am trying to return posts from one custom post type (“beaches” in this example): function get_nearby_locations($lat, $long, $distance){ global $wpdb; $nearbyLocations = $wpdb->get_results( “SELECT DISTINCT map_lat.post_id, map_lat.meta_key, map_lat.meta_value as locLat, map_lng.meta_value as locLong, … Read more

Finding all results from database within 500 miles of the given latitude and longitude [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for WordPress Development Stack Exchange. Closed 4 years ago. Improve this question I am stuck into this problem where the main requirement is to find all results from the database which are within … Read more

I have geocoded posts with latitude longitude – How to search by radius?

I have posts which are geocoded with latitude and longitude from Google. I basically can enter an address in a post custom field and the latitude and longitude are placed into two separate meta fields. I’d like to create a custom search letting visitors search their zip/postal code and find the nearest locations. I’ve found … Read more

Geo Sorting Post

I wanna sort all post by GEO Location.Can you provide me an idea on how can I do that. When user submit a post, should I ask for a location as a tag but at the same time I wanna have tags to work as tags. Also Categories needs to be work as category. I … Read more