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.
- Follow the setup wizard instructions to create your first table.
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 the WordPress admin dashboard → Post Tables → Settings.
As soon as you install the plugin, a setup wizard will launch automatically. This wizard will provide you with a step-by-step guide to help you create your first table.
In addition, you can create new tables whenever you want by navigating to Post Tables → Add New.
Here are some steps to help you through the process:
- Start by giving a name to your table and selecting the post type you want to display. If you don't have a content type, you can create one using the Easy Post Types and Fields plugin, which is free.
- Choose the movies or pages you want to add to the table. The options on this page will depend on which post type you selected on the previous page. For example, if you select an entry with a custom taxonomy then those taxonomies will be listed here.
- Customize the table to your liking. For instance, to display the movie title, summary, release year, and genre, select the type of column from the dropdown and click 'Add'. It then appears in the list of columns above. You can also reorder the columns by dragging and dropping the sort icon or column heading.
- You can make it easier for users to find what they want by adding filters to your table. For instance, if you have sorted your movie reviews by genre, you can add a filter for that. The filters appear as dropdowns above the table and you can add as many as you like. Note that the options on this page will change depending on which post type you selected on the first page.
- You can then set the default sorting option and the sort direction.
- To filter your custom post types by taxonomy, you need to create the table twice - once in the numbered list and again underneath in the text. Create a table in the numbered list and then create another table underneath the numbered list in the text. Ensure that both tables contain the same information.
- Finally, the last page confirms that you have finished creating the table and provides instructions on how to insert it onto your site. You can copy and paste the shortcode provided and add it to any page or post where you want the table to appear.
Inserting the table
After creating a table, the next step is to choose where to display it on your website. Here are two ways to insert the table into your WordPress site:
- If you're using the Gutenberg block editor, you can simply select and add the table using the 'Post Table' block.
- Alternatively, you can copy the shortcode from the last page of the table builder or from the main Tables page in the Post Tables section of the WordPress admin. Then, paste it anywhere on your site where you want the searchable database to appear, no matter what the topic is.
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!