1. Knowledge Base
  2. Posts Table Pro
  3. Posts Table Pro Options

Posts table filters

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

WordPress table post filters

How to add filter dropdowns above the table

You can enable filters for categories, tags and custom taxonomies. At the present time, you cannot show filters for the post author or custom fields.

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?

WordPress table plugin hierarchical category filtersPosts 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 rename the filters?

If your filters also appear as a column in the table, then you can rename the column and this will also rename the filter.

If your filters are not columns in the table, then the filter name is set automatically (e.g. Tags, Categories, or the name of your custom taxonomy).

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

The categories filter isn’t showing

If the categories filter isn’t showing, then it may be that you are displaying custom post types in your table.

The categories filter only appears when you are listing normal WordPress posts and does not work for custom post type categories (e.g. event categories or document categories) because these are actually custom taxonomies and not categories.

If you are categorising your custom post type, then you need to create a taxonomy filter instead of a categories filter. For example, this shortcode will add a filter for a taxonomy with the slug ‘document_category’: [posts_table filters="tax:document_category"]

My filters are showing options that don’t relate to the contents of the table

If you are using lazy_load, then the filter dropdowns will show all possible options even if these don’t relate to the items in the current table. For example, if you are listing posts in a specific category only then the ‘Categories’ filter will list all the categories on your entire website – not just the ones relating to the current table. This is because when you are using lazy load, Posts Table Pro hasn’t loaded the full content of the table and therefore doesn’t know which filter options apply to the current posts.

If this is a problem due to the way your website is structured, then here are our suggested workarounds:

  • Depending on the number of posts in your table, you can disable the lazy_load option. If you are not using lazy load then the filter dropdowns will only show options relating to the items in the current table.
  • If you can’t disable lazy load due to the number of items in the table, then you could create a custom taxonomy and use this as a filter instead. For example, if you are listing downloadable documents in a table and want to add a filter for the ‘Staff Policies’ categories only, then you could create a ‘Staff Policies’ taxonomy and add each sub-category that you need to be able to filter by. You can then add a filter dropdown for this taxonomy, instead of using the actual categories filter.
Still need help?
If searching the knowledge base hasn't answered your question, please contact support.

Related Articles