Add custom parameters to JSON API search query?

I am using JSON API plugin to query wordpress from a mobile app.

Currently I have a theme on my wordpress site which works as a directory returning “near me” results when a search is made. This is done using a custom search function builtin in the theme.

The function uses custom parameters to get the lat/lon of the user and compare it to the lat/lon of each place in the wp database to sort results by distance.

The issue I am having is that when I run the get_search_results method from the JSON API plugin the custom parameters are ignored.

Does anyone know if there is anyway I can extend the plugin to return the same results the theme is returning when performing a search.

The plugin seems to have a way to extend controllers, but I can’t seem to get my head around on how to use that to customize the search query.

Any tip putting me in the right direction will be appreciated.

Thanks!

1 Answer
1

I think it is better that you switch to the current beta, version 2, publish on github. This version is much better in possibilities and performance.

In this version it is possible that you get a result for the search term, Iike GET /wp-json/wp/v2/posts?s=awesome.

Leave a Comment