WordPress custom post types are perfect for smartly organizing website content. Allowing visitors to filter any content by taxonomies can help visitors to navigate more quickly. In this tutorial, I’ll explain how you can add custom WordPress taxonomy filters to your custom post types easily.
Since WordPress taxonomies are used to group content based on shared properties, it makes perfect sense to use them as filters.
If you already have custom post types and taxonomies set up on your website, it’ll only take minutes to set up and use taxonomies as filters. Just follow this quick guide and by the end of this tutorial, you’ll be able to add taxonomy filters to custom post types and display them in searchable tables with the Posts Table Pro plugin like so:
What are Custom Post Types?
By default, every WordPress website divides content into two post types, Posts & Pages. These two post types come preinstalled and if you wish to add more, you can do it by adding custom post types.
If you have a post category that you want to group separately, adding a custom post type is highly recommended. For example, if you publish customer success stories on your website along with blog posts, having customer success stories set up separately will help you organize them more efficiently.
If you do not have custom post types set up on your WordPress website, you can check out this detailed guide on creating custom WordPress post types. It covers everything from setting up Easy Post Types and Fields plugin to creating and displaying custom post types and taxonomies.
What are taxonomies and why use them as filters?
Simply put, taxonomies are methods to group posts or content together based on a unique relationship between them. WordPress has Categories and Tags taxonomies for default post types and you can use them in combination to group content based on their nature.
For example, if you have a blog section on your website, you can tag blog posts based on their nature such as updates, announcements, tutorials, news, or any custom category.
Taxonomies can be hierarchical too. This means every ‘topic’ can have its own ‘sub-topics’ to further organize content on the website. For example, a product review site can divide tech product reviews into these categories: mobile phones, laptops, cameras, TVs, etc.
Using taxonomies as filters make it easier for users to pull content from a particular niche. For example, on a book review site, users can select the ‘Fiction’ taxonomy and all the reviews in that category will be displayed.
How to display and filter custom post types by taxonomy
Now let’s see how you can use custom taxonomies as filters for your custom post type content.
To display and filter custom post type content, we’ll use the Posts Table Pro plugin. The plugin is designed to display and customize any post type content in the easiest way possible.
The plugin comes with extensive options to tweak and customize post tables and make them look the way you want.
Let’s see how you can use Posts Table Pro to filter custom post types by taxonomy.
Before you begin…
As I mentioned earlier, make sure you have custom post types and custom taxonomies set up on your website.
If not, you can follow this guide to create WordPress custom post types. If you already have custom post types set up on your website and want to add custom taxonomies, consider checking out this custom WordPress taxonomies guide.
For this tutorial, I’ve created a ’Movie Reviews’ custom post type and added the ‘Movie Genre’ taxonomy to filter movie reviews. Here’s what the custom post type content looks like:
Now that you have your custom post type, taxonomies, and CPT content in place, let’s start setting up filters.
Filter custom post types by taxonomy using Posts Table Pro
To filter custom post types, you need to install the Posts Table Pro plugin. Here’s how:
- Download the Posts Table Pro plugin. If you do have the plugin, you can get it here.
- Log in to the WordPress admin dashboard and go to Plugins → Add New.
- Click on the Upload button and upload the Posts Table Pro zip file.
- Click on the Install button and activate the plugin.
- In the plugin settings page, paste and activate the product license key.
Now you are ready to set up a custom WordPress taxonomy filter for your custom post type posts.
For this, go to the Posts Table Pro settings page. You can access it by going to WordPress admin dashboard → Settings → Posts Table Pro.
On the settings page, you’ll find multiple options. Since we are adding a WordPress taxonomy filter to custom post types, start by selecting the post type from the dropdown list.
Next, add the columns you want to show on your posts table for your custom post content. There are other options as well such as image size, sorting, and text settings. Feel free to adjust them to suit your needs.
Adding a custom WordPress search filter
In the settings list, you’ll find the Search filters option. By default, it would be disabled. Change this to Custom.
Now in the text field below, type in your taxonomy slug with
tax: text. For example, if your taxonomy slug is ‘genre’, type in the text as
If you wish to add more filters, type in the other filters in the same text field separated by a comma ‘,’.
Now click on the Save Changes button.
Now for the last step, you just need to display the table on your website’s frontend.
For this create a new page or open an existing one. Paste the
[posts_table] shortcode and publish it.
Your custom post type table with a WordPress taxonomy filter is now published on the website. This is how our table with the Genre filter.
You can also display the custom taxonomies as table columns. This will allow your viewers to sort the table by clicking on the table column and filter the table by clicking on the taxonomy term. This will work even if you do not have custom filters enabled.
Start displaying taxonomies as filters with Posts Table Pro!
With the steps mentioned above, you can easily create, set up, and display taxonomies as filters on your website with Posts Table Pro. Not just taxonomies, you can use custom fields or any other post data as filters to make the navigation easier for your website visitors.
With the Posts Table Pro plugin, you can:
- Effortlessly display custom post type content in sortable tables.
- Add category, tags, and custom taxonomy filters.
- Display any content on your WordPress website in tabular format.
- Embed video and audio directly into the table.
You also get a no questions asked 30-days money-back guarantee with the Posts Table Pro plugin so you can test it on your website without any worry.
If you are looking for an easy way to display custom post type content with a custom WordPress taxonomy filter, Posts Table Pro is perfect for you!