Filter Search Results from the GeoDirectory REST API

Examples:

1) Using Latitude & Longitude
– latitude=xxx.xxxxxx&longitude=xxx.xxxxxx
– Example:

/wp-json/geodir/v2/places/?latitude=21.8380&longitude=73.7190&distance=10&orderby=distance&order=asc

2) Using IP Address

– ip=xxx.xxx.xxx.xxx
– Example:

/wp-json/geodir/v2/places/?ip=103.216.82.146&distance=10&orderby=distance&order=asc

3) Using Near Me (auto-detects IP of the user and find nearest posts)
– near=me
– Example:

/wp-json/geodir/v2/places/?near=me&distance=10&orderby=distance&order=asc

4) Using Address
– near=xxxxxx
– Example:

/wp-json/geodir/v2/places/?near=Surat&distance=10&orderby=distance&order=asc

5) Search by distance 

To filter API results with use of latitude & longitude.

Requires the Location Manager and Advanced Search Filters addons both to be installed and active and then proceed to configure 'Search by Distance' for each CPT in: Places (CPT) > Settings > Search > Search by Distance

/wp-json/geodir/v2/places/?latitude=45.889&longitude=6.172&distance=5&orderBy=distance&order=asc
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us