Would be good to add in an optional final parameter for the getPostIDsByRange function to be able to set a limit to the number of results. With high numbers of posts with geolocation, it’s faster to limit the SQL query than limit the loop after getting them.
geo-data-store.php
Line 346 (defaults to as close to infinite as MySQL query allows)
public static function getPostIDsByRange($post_type, $search_lat = 51.499882, $search_lng = -0.126178, $orderby = "ASC", $limit = 18446744073709551615)
Line 375 (add new line)
LIMIT $limit
For anyone interested, since this plugin and support forums seem a bit out of date. I have cloned the plugin and added this feature. You can find a new repository here: https://github.com/egojab/Geo-Data-Store I’m not sure what, if any, updates will be added moving forward.
]]>Hello, this is an awesome plugin but I’m having trouble getting it to create a new table. My keys are being stored within my _postmeta table. Am I missing something obvious? Thanks.
]]>You are searching the radius using mile (using 3956). Perhaps you could add a filter to change the value. In my case, I need the search using kilometer (6371).
There is another thing I noticed, in this google article, they are using 3959 for calculation.
]]>