Why Let Users Filter Posts and Pages in WordPress?

By default, WordPress comes with categories and tags 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?
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.

Allowing Users to Easily Filter Posts and Pages

The first thing you need to do is install and activate the Search & Filter plugin.
Upon activation, the plugin will add a new menu item labeled Search & Filter to your WordPress admin bar.


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.
1. [searchandfilter fields=”search,category,post_tag”]
You can also use the shortcode as a template tag in your WordPress theme files like this:
This will display the filtering options with search, category, and tags fields.add-filter-criteria

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:

1. [searchandfilter fields=”search,category,post_tag,post_types,post_date”]

Now instead of using a drop down a select field, you can also use checkboxes and add labels for each field.
If you use a separate page to display your blog posts, then you can add this shortcode to the page.
1. [searchandfilter headings=”Select categories:” types=”checkbox” fields=”category”]
Filter Posts and Pages
If you are using multiple fields, types, and headings.

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

You can also use these shortcodes inside a text widget.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *