Posts table filters
filters option in Posts Table Pro allows you to display dropdown lists above your table which allow users to filter (i.e. search) the table by selecting an item from the list. For example, you can use the categories filter to select a category from the list – this will filter the table to show posts from that category.
Note: This page covers the options for letting your users filter the table to narrow down the list of posts. If you want to create tables listing specific posts based on their category/date/tags etc. (i.e. perform a filter before the table first loads), check out this article instead.
How to add filter dropdowns above the table
You can enable filters for:
tags and any custom taxonomy. At the present time, you cannot enable filters for a custom field.
To show filters based on the contents of the table, add
filters="true" to the Posts Table Pro shortcode. This will show all filterable columns as filters above your table.
This example would show categories and tags as search filters:
[posts_table columns="title,categories,tags" filters="true"]
To specify which filters are shown (regardless of the columns displayed), you can list the filters to be included, e.g:
[posts_table columns="image,title,content" filters="categories,tax:my_taxonomy"]
The filters are displayed above the table by default, but if you have positioned the search box below the table, then the filters will also appear below the table.
Can I show the filters before the table loads?
Unfortunately not. The filters can only be appear above the table. They are designed to refine the items in the table, and not to perform a filter before the table first loads.
Can I list categories and sub-categories as separate filter dropdowns?
Posts Table Pro lists all categories (or taxonomies) in a single dropdown list.
The list is nested/hierarchical so that you can see which are the parent categories and which are child categories.
Can I control the order of the dropdown items?
The filter dropdown lists are ordered alphabetically and there are no options to change them.
If you’re using the filters to list something where alphabetical sorting isn’t appropriate (e.g. dates), then you could add numbers before each item to control the order. For example, if you’re using categories to filter by month, then you could name your categories ’01 – January’, ’02 – February’, and so on.
Can I filter by custom fields?
Posts Table Pro doesn’t come with custom field filters because this is not how custom fields are intended to be used. We recommend that you store this extra data as custom taxonomies rather than custom fields, as these can be filtered.
Custom fields are designed to store unique data, and as such they’re not supposed to be filterable. In contrast, custom taxonomies are like categories and are designed to group and sort posts and other WordPress post types.
If you don’t know how to create custom taxonomies then we recommend the Custom Post Type UI or Toolset Types plugin. These let you create custom taxonomies for any post type in WordPress. You can then list the custom taxonomies and their terms as filter dropdowns above the table.
Can I add checkbox filters?
Posts Table Pro only comes with dropdown list filters, and there’s no feature to add check box filters instead. The dropdown filters are very flexible and you can add as many as you like, instead of using checkboxes.