---
title: Static filters
description: "There are two ways to add a static filter to a data table: 1. Default where clause 2. Shortcode parameters ## 1. Default where clause The default where clause supports conditions, subqueries and other more complex filters as long as…"
url: "https://docs.legacy.wpdataaccess.com/docs/static-filters/"
updated: "2025-11-21"
category: Legacy Tools / Tables / Filters
---

# Static filters

There are two ways to add a static filter to a data table:

1. Default where clause
2. Shortcode parameters

## 1. Default where clause

The default where clause supports conditions, subqueries and other more complex filters as long as it contains valid SQL.

### Using plugin variables in your default where clause

  The [WordPress user ID](https://docs.rad.wpdataaccess.com/wpda_wp_user_id.html) and some [pre-defined plugin environment variables](/docs/environment-variables/) are available in the default where clause. The following example demonstrates how the WordPress user ID can be used to limit query output.  [![](https://wpdataaccess.com/wp-content/uploads/2023/03/wpda-default-where.png)](https://wpdataaccess.com/wp-content/uploads/2023/03/wpda-default-where.png)

### Using URL parameters in your default where clause

Premium users can also use URL parameters in their default where clauses. The following notations allow user to access these values:

| **httpGet['param_name']** | Return the value of parameter **param_name** for an HTTP GET request |
| --- | --- |
| **httpPost['param_name']** | Return the value of parameter **param_name** for an HTTP POST request |
| **httpRequest['param_name']** | Return the value of parameter **param_name** for an HTTP GET and POST requests |

#### Notes

- Null is returned when no argument with the given name is found
- Values are sanitized and prepared automatically

#### Examples

Show only rows for a specific student

```
student_id = httpPost['student_id'] and httpPost['student_id'] is not null
```

Add a like condition using if

```
first_name like if( httpGet['student_firstname'] is null, first_name, concat( '%', httpGet['student_firstname'], '%' ) )
```

Show only rows for a specific student when parameter student_id is present or all rows if parameter student_id is not present

```
student_id = ifnull( httpPost['student_id'], student_id )
```

## 2. 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.

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.
