There are two ways to use URL parameters:
- Add them explicitly to a default where clause
- Let the plugin add them automatically to a query
1. Add a URL parameter to a where clause #
- httpGet[‘param_name’]
- httpPost[‘param_name’]
- httpRequest[‘param_name’]
2. Let the plugin add them automatically to a query #
To add a filter on a specific table column you can add an URL argument to your request that follows the following name convention:
wpda_search_column_<column_name>
The free version supports only http GET requests. The premium version support http POST request as well.
Examples #
Request: YOUR-URL/?wpda_search_column_first_name=Sacha
Adds condition: first_name = ‘Sacha’
Add a custom HTML input field to query field first_name
<input name="wpda_search_column_first_name" type="text" value="Sacha" />
Wilcards in URL parameters #
YOUR-URL/?wpda_search_column_title=Last%25
The decodeURIComponent was added for the safer handling of URL arguments. Use %25 (url safe) instead of just % as a wildcard.
IN conditions #
Use arrays to filter a column on multiple values (allows wildcard usage as well). For example:
YOUR-URL/?wpda_search_column_first_name[0]=Sacha&wpda_search_column_first_name[1]=Peter
YOUR-URL/?wpda_search_column_first_name[0]=Sacha&wpda_search_column_first_name[1]=Peter
Adds condition : first_name = ‘Sacha’ OR first_name = ‘Peter’
OR conditions #
Use parameter wpda_search_column_operator to compare using OR instead of AND. The plugin uses AND by default.
Example AND (default) #
YOUR-URL/?wpda_search_column_first_name=Sacha&wpda_search_column_last_name=Schulz
Adds condition: first_name = ‘Sacha’ AND last_name = ‘Peter’
Example OR #
YOUR-URL/?wpda_search_column_first_name=Sacha&wpda_search_column_last_name=Schulz&wpda_search_column_operator=or
Adds condition: first_name = ‘Sacha’ OR last_name = ‘Peter’
It is currently not possible to combine AND and OR conditions with URL parameters.