WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Plugins» How to Let Users Filter Posts and Pages in WordPress

How to Let Users Filter Posts and Pages in WordPress

Last updated on May 1st, 2017 by Editorial Staff
140 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Let Users Filter Posts and Pages in WordPress

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.

140 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • How to Properly Move Your Blog from WordPress.com to WordPress.org

  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

15 Comments

Leave a Reply
  1. Marwan Nour says:
    Jul 22, 2019 at 6:17 am

    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

    Reply
    • WPBeginner Support says:
      Jul 22, 2019 at 1:26 pm

      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.

      Reply
  2. Tom Ale says:
    Oct 17, 2018 at 9:53 am

    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.

    Reply
  3. Sébastien Albert says:
    Aug 30, 2018 at 4:06 am

    Hi,
    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
    Sebastien

    Reply
  4. Soumik Sadman Anwar says:
    Jul 18, 2018 at 11:33 am

    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?

    Reply
  5. Pavel says:
    May 13, 2018 at 7:08 pm

    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?

    Reply
  6. Wolney Mamede says:
    May 7, 2018 at 11:24 am

    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.

    Reply
  7. Sultan Haider says:
    Mar 15, 2018 at 1:53 am

    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.

    thanks

    Reply
  8. Christine says:
    Jan 21, 2018 at 4:21 am

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

    Reply
  9. Pawan says:
    Oct 15, 2017 at 3:07 am

    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).

    Reply
  10. Maz says:
    May 16, 2017 at 11:45 pm

    Hi,
    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?

    Thanks

    Reply
  11. Matus says:
    Apr 28, 2017 at 5:31 am

    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.

    Reply
  12. Patxi says:
    Apr 27, 2017 at 11:46 am

    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!

    Reply
  13. Omer Causey says:
    Apr 27, 2017 at 10:01 am

    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.

    Reply
    • WPBeginner Support says:
      Apr 27, 2017 at 10:12 pm

      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.

      Reply

Leave a Reply Cancel 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.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
OptinMonster
OptinMonster
Convert website visitors into email subscribers. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2021 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2021)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2021)
    • SiteGround Reviews from 4464 Users & Our Experts (2021)
    • Bluehost Review from Real Users + Performance Stats (2021)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2021 – Step by Step Guide
Deals & Coupons (view all)
ON1 Photo
ON1 Software Coupon
Get 20% off ON1 Photo Raw, ON1 Resize, and other ON1 Software.
Sprout Invoices
Sprout Invoices Coupon
Get 50% OFF on Sprout Invoices WordPress invoicing plugin.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).

Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
  • Growth Fund
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon
  • AIOSEO

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress Security by Sucuri.