Post queries by latitude and longitude
Close. You need another INNER JOIN and should escape all your variables using $wpdb->prepare. I’ve also included a more efficient Haversine formula (source) to calculate the radius. If you use kilometers, then change the $earth_radius to 6371. Also, a great way to debug is to echo the sql and paste it into phpMyAdmin (or whatever … Read more