There are three ways to add a static filter to a data table:
- Default where clause
- Shortcode parameters
1. Default where clause #
Data Tables allows plugin users to add any default where clause (click image below to enlarge). This includes subqueries and other more complex filters. The default where clause also supports the $$USER$$, $$USERID$$ and $$EMAIL$$ environment variables to filter user specific data (user must be logged in).
2. Shortcode parameters #
- filter_field_name (field name(s) to be filtered)
- filter_field_value (field value(s) to filter, performs a LIKE and therefor allows wildcards)
Example of a filter for one specific column
[wpdataaccess pub_id="18" filter_field_name="lastname" filter_field_value="jose%"]
For filters containing multiple column names and values, use a comma seperated value and make sure the array size of filter_field_name and filter_field_value are the same.
Example of a multiple column filter
[wpdataaccess pub_id="6" filter_field_name="job,ename" filter_field_value="president,ford"]
The filter allows to use % as a wildcard as shown in the single column filter example. These filter parameters do not support operators like IN, OR, NOT, >, < and so on. Please use the default where clause to use these operators and more complex filters.