Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

How to Let Users Filter Posts and Pages in WordPress

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Do you want to allow users to filter posts and pages on your WordPress site? Recently, one of our users asked us how to add filters to their WordPress site allowing users to filter posts by category, tags, post types, etc. In this article, we will show you how to let users filter posts and pages in WordPress.

How to Let Users Filter Posts and Pages in WordPress

Why Let Users Filter Posts and Pages in WordPress?

By default, WordPress comes with categories and tags as a way for you to sort content into topics and for your users to easily find it.

However, users can only view one category, tag, or archive page at a time and it will only show one post type.

What if you wanted users to be able to filter content in more than one category or tag? How about allowing users to view posts, pages, and custom post types at the same time?

This kind of filtering can be particularly helpful when you have a lot of content, and you want users to filter it according to their own preferences.

Having said that, let’s take a look at how to easily let users filter posts and pages in WordPress.

Video Tutorial

Subscribe to WPBeginner

If you don’t like the video or need more instructions, then continue reading.

Allowing Users to Easily Filter Posts and Pages

First thing you need to do is install and activate the Search & Filter plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, the plugin will add a new menu item labeled Search & Filter to your WordPress admin bar. Clicking on it will take you to the plugin’s usage page with detailed documentation on how to use the plugin.

Search & Filter plugin documentation

Search & Filter plugin comes with a shortcode which accepts different parameters to display the filtering options. You can use this shortcode in a post, page, or inside a text widget.

[searchandfilter fields="search,category,post_tag"]

You can also use the shortcode as a template tag in your WordPress theme files like this:

<?php echo do_shortcode('[searchandfilter fields="search,category,post_tag"]'); ?>

This will display the filtering options with search, category, and tags fields.

Filter posts by category and tags

By default the plugin accepts search, taxonomy, post_type, and post_date as fields.

Let’s take a look at another example. This time we will include category, tags, post types, and date fields.

You will need to use the shortcode like this:

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

Here is how it would look:

Adding all fields to the filter

Now instead of using drop down select field, you can also use checkboxes and add labels for each field. To do that, you will need to add two more parameters to the shortcode.

If you use a separate page to display your blog posts, then you can add this shortcode to the page.

[searchandfilter headings="Select categories:" types="checkbox" fields="category"]

Allowing users to select multiple items in the filter using checkbox

If you are using multiple fields, types, and headings, then you need to make sure that items are in the same order for each parameter.

Let’s see another example. This time we are adding category, tags, and post type fields with different headings and form field types.

[searchandfilter headings="Post type, Category, Tag" types="checkbox, select, select" fields="post_types,category,post_tag"]

This is how it would appear on your site:

Advance filtering with headings and different field types

Please refer to plugin’s documentation page for more ways to use the shortcode.

You can also use these shortcodes inside a text widget. If the shortcode doesn’t work in your text widget, then please see our guide on how to use shortcodes in your WordPress sidebar widgets.

We hope this article helped you learn how to let users filter posts and pages in WordPress. You may also want to see these actionable tips to drive traffic to your WordPress site.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

17 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Himanshu Gautam says

    I am using this plugin
    is there any option to select a category without hitting the submit button?

  3. Marwan Nour says

    Hello there,

    I am trying to implement Search & Filter in a website that’s both in Arabic and in English. The English version of the Search & Filter is working well however in the Arabic Version, after hitting search, I am redirected to the English Version of the search page with the results in English. Can anyone help me with that issue please? Thank you

    • WPBeginner Support says

      You would want to reach out to the plugin’s support to see if this could be a conflict with the plugin and the translation plugin you’re using.


  4. Tom Ale says

    Hi, I am using WordPress with Gantry.
    I installed this plugin and used a shortcode. It appears where it suppose to be. When clicking the button to filter content, nothing happens. Did anyone face this problem? Help, please.

  5. Sébastien Albert says

    Search & Filter looks great. But could you tell me if it can do that :
    I would have a filter on tags but only on one category which I could define…

    Thanks a lot

  6. Soumik Sadman Anwar says

    How can I create filter options in a single post?

    For example, If I am interested in writing a post “Necessary Tools to Build A Website” and want to include filter options like Purpose Based Tools (like SEO, Design etc.) and the Price option (Free or Paid), how do I do it?

  7. Pavel says

    Great plugin, but have some limitations and bugs.
    1. No Reset button.
    2. When I uncheck all checkboxes and press Submit, it transfers to the front page.
    Maybe there’s an option Show all?

  8. Wolney Mamede says

    First of all, thanks for the post.
    I would like to know if it is possible to filter the search from the group of fields, created from the “Advanced Custom Fields – v. 4.4.12” plugin.
    Also by default, the search would be restricted to a custom post type from the “Custom Post Type UI – v. 1.5.8” plugin.

  9. Sultan Haider says

    Hi, I had created employ database on tablepress and i want to filter in front end employ according to year wise for example if i select 2013 this shows only those employ which join in 2013.
    i have perform lot of research but i cant find free pluggin according to my need.
    please help me for suggestion.


  10. Christine says

    Thanks a lot for the comprehensive article. Do you know if it is also possible to have only certain tags in the dropdowns?

  11. Pawan says

    Great Job. just one last question. Instead of searching the post, is it possible to search category using the search string? I would like to show all the possible post in search page and then the category if it matches the search string (partially or fully).

  12. Maz says

    Great as always.
    I just wonder would the use of this plugin be recommended on a site with many posts? Will it not lead to slower load time?


  13. Matus says

    Could you please give us a little bit deeper look to your behind the scenes? (in Blueprint post you write only what you’re using – you can also write if you want, how to properly set up plugins, themes…)
    For example tutorial on 10 tips and trick to masterize or customize Genesis Framework would be really really helpful.

  14. Patxi says

    Hi WPBeginner!

    In relation to the filters of new taxonomies, a question of initiation, how I can visualize in the post a new taxonomy for a second type of labels that later I can filter with this plugin?

    It would be an interesting topic.

    Thanks for you post!

  15. Omer Causey says

    Your suggestions for allowing users to filter posts are welcome, but the explanation of how and where to insert the required shortcode is beyond this beginner’s understanding.

    • WPBeginner Support says

      Hi Omer,

      You can add the shortcode in a post or page. If you want to display the filter site-wide then you will need to edit your WordPress theme files and use the template tag instead.


Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.