Creating tables with specific posts based on category, taxonomy, custom field, date & more
Posts Table Pro comes with lots of options for choosing which posts are included in the table. You can display posts with a specific category, tag, post type, status, custom taxonomy term, custom field or date (year, month or day). You can also show or hide specific products from the table based on their ID, and exclude certain categories.
category option lets you choose which blog post categories are displayed in the table. This applies to blog posts only (i.e. the default, where post_type is set to
post). If you’re displaying pages or other custom post types, this option has no effect and you need to use the ‘term‘ option instead (see below).
You should specify the category slug or ID – this can be found under the Posts -> Categories menu in the WordPress dashboard. You can also specify multiple categories to display – either separated by commas or by a plus sign (+). If you use commas it means “posts in this Category A or Category B”. If you use a plus, it means “posts in Category A and Category B”.
For example, to display posts which are in the “design” category or in the “print” category, use:
To display posts which are in the “design” category and in the “print” category, use:
category option only applies to normal WordPress posts, which you manage via the ‘Posts’ section on the left of the WordPress admin. It does not work for custom post type categories (e.g. event categories or document categories) because these are actually custom taxonomies and not categories. To show custom post types from a specific ‘category’, use the
term option instead.
Can I list categories and sub-categories separately?
All posts are displayed in a single list, regardless of whether they are in a parent category or child category.
If you want to list posts separately based on their category, then we recommend adding multiple tables to the page. Each table should list posts from a different category or subcategory. You can divide up the page by adding the category name as a subheading above each table.
tag option applies to blog posts only and selects posts based on their tags. If you’re displaying pages or other custom post types, this option has no effect and you need to use the ‘term‘ option instead (see below).
Use the tag slug or tag ID – you can find this in WordPress under the Posts -> Tags menu.
As with categories, you can use one tag or several tags, and you can use commas or a plus sign to denote how tags should be checked. Using commas means “posts with this tag OR that tag”; using the plus sign (+) means “posts with this tag AND that tag”. You can’t mix and match commas and pluses – it’s one or the other.
Example 1: Display posts with tag “awesome”:
Example 2: Display posts with tags “cool”, “awesome” or “good”: [no_shortcodes]
Example 3: posts with tags “cool”, “awesome” and “good”:
post_type option determines which post type (or types) will be displayed in the table. The default is
post which will display blog posts. For pages use
post_type="page". For attachments you can use
For custom post types, you will need to find the ‘slug’ for that post type. The easiest way to do this is to go to the main page for your post type in the WordPress admin and look at the URL. For example, WooCommerce has a ‘products’ post type. If you go to the ‘Products’ menu in the admin, you will notice in the URL in your browser that it looks something like: “../wp-admin/edit.php?post_type=product”. The “product” bit is the post type you need to use. If you’re using Easy Digital Downloads, use
You can also use a list of post types, separated by commas. For example
post_type="page,post", will display all blog posts and pages.
Example 1: Display pages:
Example 2: Display Easy Digital Downloads AND WooCommerce products in a table:
Example 3: Display a custom post type with the slug ‘members’:
status option displays posts in the table based on their status.
The default status is
publish. The other options are
any. Pending posts are those pending a review. Future posts are those scheduled to be published at a future date. Private posts have their visibility set to Private which means they can only be viewed by the post author or other administrators.
You can also use a list of post statuses separated by commas, for example:
[posts_table columns="title,author,categories" post_status="publish,draft"]
Custom taxonomy term
term option creates a table that only displays posts with the the specified term or terms. The taxonomy that you specify here doesn’t have to be a column in your table.
Use the format:
term="<taxonomy slug>:<term slug or ID>". You can enter one term or multiple terms and, as with categories and tags, you can separate terms using a comma (,) or a plus sign (+) to denote whether the posts have any of the terms specified or all of them.
You need to prefix this option with the slug of the taxonomy followed by a colon. For example, to display WooCommerce products that have the product category “coats”, we would use:
[posts_table columns="title,content" post_type="product" term="product_cat:coats"]
To display posts with multiple terms, separate terms by a plus sign (AND) or a comma (OR). If you are selecting from several custom taxonomies, you need to add the taxonomy slug before each term.
The following example will display posts with a document_type of policy or memo:
[posts_table columns="title,content" post_type="document" term="document_type:policy,memo"]
The following example will display posts with a document_type of memo and a document_status of approved:
[posts_table columns="title,content" term="document_type:policy+document_status:approved"]
cf option is used to select posts based on a custom field value. You should use the format
cf="<field name>:<field value>" when using this option. As with the above options you can enter one custom field to check, or several, and can separate them using a comma or a plus sign (see categories or tags for more details).
For example, if you are displaying a “car” custom post type and wanted to display cars which are either blue OR are Audis, you would use:
[posts_table post_type="car" cf="color:blue,make:audi"]
If you wanted to list posts with either of two values from the same custom field (for example cars that are blue or red) then you would use:
[posts_table post_type="car" cf="color:blue,color:red"]
However if you wanted to select the blue Audis (i.e. have color = blue AND make = audi) you would use:
[posts_table post_type="car" cf="color:blue+make:audi"]
Custom fields added using the Toolset Types plugin
If you’re using Toolset Types to create your custom fields, then you need slightly different syntax to display them in the product table.
wpcf- to the start of the custom field name, so if you create a custom field called ‘color’ with a value of ‘blue’ then the correct syntax will be
wpcf-color:blue. This means that if you want to create a table displaying posts with a custom field value of ‘blue’ then you would need to add it as follows:
Display posts based on when they were published
The following three options control which posts are displayed based on the date they were published.
year option can be set to limit posts to a specific year. E.g.
Selects posts from a specific month. You should use a number here between 1 and 12. You can combine this with the year or day options if you want more fine grained control, e.g.
[posts_table year="2015" month="11"]
Selects posts from a specific day in the month. You should use a number between 1 and 31, and as above, you can combine this with the year or month options, e.g.
[posts_table month="4" day="25"]
author option displays posts from a specific author. Use the author ID or a list of IDs.
exclude option can be used to exclude posts or pages from your results based on their post ID. You can enter one ID or a list or IDs.
For example, if you were displaying a table of pages, but wanted to exclude the current page (id=23) which the table is displayed on, you would use:
[posts_table columns="title,content" post_type="page" exclude="23"]
include option can be used to show only specific posts or pages in your table. You can enter one post ID or a list or IDs separated by commas. Note that
exclude are mutually exclusive – if you set one, the other will be ignored.
Example displaying 4 specific posts:
exclude_category option is used to exclude entire categories of posts from your table. You can use category IDs or slugs, and it can be one category or a comma-separated list.
Can I list users with Posts Table Pro?
Unfortunately Posts Table Pro can’t list users because users are not a post type in WordPress and are stored in a different database table. Instead, we recommend that you create a custom post type and use it to store your members. We have an in-depth tutorial about how to create a member directory with Posts Table Pro.