Hosting Tutorial & Guide

How to Add a Post Filter to Your WordPress Site

updated on May 04, 2017
How to Add a Post Filter to Your WordPress Site By default, WordPress allows users to sort content by tags and categories so that visitors can filter posts and pages with the preset topics. But what if you want to provide a fully functional filter that gives more flexibility to the visitors?

Your visitors can certainly find the content they want by using the search box or clicking on a tag/category name, but there are limitations. They can view one tag or category only at a time, and a single post type is displayed.

The good news is that now it is possible for you to allow visitors to combine post types, categories, tags, dates and more when searching on your WordPress site. All you should do to achieve this is to add an advanced post filter to your site. This is super easy as you can take advantage of plugins. If you need detailed tutorials, continue reading.

Add a Post Filter to WordPress with Plugin

The plugin we recommend here is named Search & Filter. This plugin enhances the WordPress search function and allows you to add multiple filters. The available choices include tag, category, post type, post date and custom taxonomy. You can use any of them in the filter, or use any combination of these fields. Besides, AJAX is utilized for faster website performance.

For those sites with heavy content or numerous products to sell, Search & Filter makes it easier for visitors to find the exact content and the relevant content.

Add Filter with Search & Filter

Add a post filter with Search & Filter

First of all, you need to install the plugin as you always do when using any other WordPress plugins. Upon activation, you will get a Search & Filter menu item in the admin area. Clicking on it, you are going to see the full details about the plugin and the guides for using it.


As the plugin suggests, you get two ways to apply it. The first is to embed the shortcode displayed in the screenshot above to a WordPress post, page or text widget according to your preferences. However, you must pay attention that if you want to display the filter in the sidebar, you may need to allow shortcode in text widgets by following this tutorial in the case that shortcode is not enabled in text widgets by default.

The other choice, then, is to add a line of code to a template file. This method is suitable for those who have the necessary skills of the basic coding and theme customization.

By embedding the ready-to-use shortcode, you will get a simple filter like what shown below.

Default Post Filter

Customize the post filter

According to your needs, you can customize the filter with different fields, field types and headings by making modifications to the parameters in the shortcode simply. For the fields, the plugin supports search, post date, post types, and taxonomy. Below is an example of using multiple ones of them.

[searchandfilter fields="search,category,post_types,post_date"]

This shortcode generates the following filter.

Filter with Multiple Fields

By default, the fields are displayed in dropdowns, but the plugin still allows you to use checkboxes. A custom heading is also available as long as you add the corresponding parameters to the shortcode. Below is an example.

Change Filter Type and Heading

Final Thought

Besides the examples above, Search & Filter also offers some other customization options which you can learn in its documentation. Advanced users who find the design not good enough can even style the CSS. If you are looking for a way to add a filter to WordPress, this plugin should be a good choice.