Skip to content

Data Filtering

Each layout’s Data section filters the View’s data before the layout renders it, with the description “Filter the data of the view before it is being rendered.” The filters run on the server, so rows they exclude never reach the browser. A Default post screen layout has no Data section.

Filters and conditions

The section holds a list of filters:

  • Add filter adds a filter. A row is included when it matches at least one filter (OR).
  • Inside a filter, Add AND condition adds a condition. A row matches the filter only when it meets every condition in it (AND).
  • Remove filter group removes a filter, and the bin button on a condition removes that condition.

With no filter, the layout includes every row of the source.

A condition

Each condition has:

  • Column: any column of the source. For a post type that includes the post fields, custom fields and taxonomies; a taxonomy is listed as Tax: <name>.
  • Operator: the comparisons that fit the column, listed below.
  • Value: what to compare with. A column with fixed values, such as a taxonomy or a status, offers them in a list; a number column takes a number and a date column a date.
  • Negate: inverts the condition, so a row matches when the comparison is false.
Column type Operators
Text equals, contains, starts with, ends with, length equals, length is greater than (or equal to), length is less than (or equal to), word count equals, word count is greater than (or equal to), word count is less than (or equal to)
Number equals, is greater than, is greater than or equal to, is less than, is less than or equal to
Date equals, is after, is on or after, is before, is on or before
Fixed values equals: a taxonomy matches rows that have the term, a status rows with that status

A custom table and a SQLite file take every operator above, tokens included. Everywhere, including post meta, a length counts characters and a word count counts words separated by single spaces, with none in an empty value. Taxonomies and statuses belong to post types only.

Dynamic values

A text value may hold a token that is replaced when the query runs. The value field suggests them as you type, grouped by what they read:

  • User: {user.id}, {user.email}, {user.login}, {user.role}, {user.meta.KEY} and more
  • Date & Time: {date.today}, {date.yesterday}, {date.now}, {date.current_year} and more
  • Post, Author, Site, Request, Query and others, such as {post.id}, {post.meta.KEY} and {request.get.PARAM}

Replace KEY, PARAM and similar placeholders with the name you need. For example, a custom field assigned_to that equals {user.login} limits a layout to the rows assigned to the current user.

The layout’s own Data filters replace every token. In the filters people apply – the filter bar and custom filters – only Date & Time tokens are replaced for users who cannot edit posts.

Examples

  • Published news posts: one filter with two conditions, the status equals Published and the category taxonomy equals News.
  • News or events: two filters, one where the category taxonomy equals News and one where it equals Events.

Filters people apply

A table can also offer filters to the people using it – the filter bar, search and custom filters – and Kanban and Feedback layouts can offer search. These narrow the layout’s own Data filters; they never widen them.

Stay in the Loop!  

Be the first to hear about new updates, special offers, and helpful tips, delivered straight to your inbox.

We respect your inbox (and your privacy). Read our privacy policy.