1. Home
  2. Docs
  3. Index
  4. Data Publisher
  5. Adding filters

Adding filters

There are three ways to add a filter to a publication:

  1. Default where clause
  2. Shortcode parameters
  3. URL parameters

Default where clause

The Data Publisher allows plugin users to add any default where clause to a publication (click image below to enlarge). This includes subqueries and other more complex filters. The default where clause also supports the $$USER$$ and $$USERID$$ environment variables to filter user specific data (user must be logged in).

Shortcode parameters

Shortcode wpdataaccess provides two parameters to filter data:

  • 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:

[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.

URL parameters

To add a filter on a specific table column you can add an URL argument to your request that follows the following name convention:


This works for POST and GET request!


<input name="wpda_search_column_first_name" type="text" value="Sacha" />

Adds condition

first_name = 'Sacha'
Was this article helpful to you? Yes No

4 Replies to “Adding filters”

  1. Hi, is it possible to set the order by attribute in the admin page with a column that is not selected in column names? For example sort by date_time column but I don’t choose this column in column names because I don’t want to how this column in the result.

    1. Yes Michal, you can do that, although it might be a bit confusing fo a user to get a sorted list without seeing the sorting column. Please keep in mind that a user can change the order by clicking on the header of another column.

  2. Hi, I am still evaluating your plugin and I might already be pushing it to the limit. But is there a way to filter the content with the help of user meta? I tried WHERE Clause: FIELD_NAME = ‘get_the_author_meta( ‘FIELD_NAME’, $user->ID )’ with zero result.

    1. Hi Clas, You can use FIELD_NAME=$$USERID$$ to compare with the user id or FIELD_NAME=$$USER$$ to compare with the user name. You cannot use PHP functions in a where. Hope this helps, Peter

Leave a Reply

Your email address will not be published. Required fields are marked *

12 + 7 =