What's WP
Our everything is about WordPress - best choice of WordPress users!
How to Implement Faceted Search on WordPress Sites

How to Implement Faceted Search on WordPress Sites

Faceted search, which is also known as faceted navigation, is a technique that allows users to access the website information they want by applying multiple pre-defined filters. For large sites containing heavy content that is organized by a large number of categories, faceted search is necessary for helping visitors locate the exact information they are searching for.

Due to the excellent filtering ability, faceted search is widely applied on eCommerce sites with numerous products and categories, such as Amazon, eBay and Etsy. However, the use of faceted search tools is not limited to eCommerce only. As long as you run a website with strictly categorized content, you can surely benefit from a well-designed faceted search feature.

Faceted Search

To implement faceted search on WordPress sites, the easiest way is to use a plugin, while there are still some other solutions if you want more customization and enhancement options. For example, you can make use of PHP frameworks that have already handled the most complicated tasks while offering you enough control.

If you are interested in faceted search and want to apply it on your WordPress site, the tutorials below are the places to get started.

Implement Faceted Search by Using Search & Filter Plugin

Generally speaking, faceted search is a technique that enhances the WordPress search function by adding various filters. After searching through WordPress plugin directory, we have found a good filtering plugin named Search & Filter.

This plugin is designed to improve the built-in WordPress search box. It supports post types, categories, tags, custom taxonomies, post meta, custom fields and authors, which makes it good for filtering WordPress posts and pages. Besides, you get multiple choices for displaying fields, including checkboxes, dropdowns, multi-selects and radio buttons. The combination of the fields helps you refine searches easily.

Besides, there are some other facts about the plugin that you may want to know.

  • Results are loaded using AJAX, so no reloading is needed.
  • The plugin can be used for review sites, blogs, news sites, etc, and it is compatible with WooCommerce, Easy Digital Downloads and WP eCommerce.
  • It supports unlimited fields and search forms.
  • Search results can be ordered by post ID, date, author, comment count, meta value, title, and more.

Implement Faceted Search with Search & Filter Plugin

The Search & Filter plugin is extremely easy-to-use because there is no setting to deal with. All you need to do is to install the plugin, activate it, and make use of its shortcode. There is only one shortcode offered, but you can achieve different goals by customizing it.

Clicking on the “Search & Filter” menu in WordPress dashboard, you will be able to learn the basic uses of the shortcode.

Search & Filter Shortcode

By using the minimal shortcode shown above in a post or page, you will get dropdowns for categories and tags. These filters can also be added to the sidebar or the footer area.

Show Categories and Tags with Dropdowns

To customize the filters, you can add more arguments to the shortcode. The available arguments allow you to change the filter type, display the search fields hierarchically, hide the empty taxonomies, show the post/item count for taxonomy items, and do many more to better meet your own needs.

Search & Filter Arguments

To help you get familiar with the use of the shortcode, we’d like to show several examples of it.

Example 1: Show headings for all fields except for the search box.

Show Headings

Example 2: Show categories and tags with headings and radio buttons.

Use Radio Buttons

Example 3: Show categories and tags with headings and checkboxes.

Use Checkboxes

Example 4: Show categories hierarchically.

Use Hierarchical Structure

Besides the examples, there are still dozens of other combinations of different arguments. You can learn all the arguments you can use on this page. And if you would like to, you can also customize the styles with custom CSS.

An Advanced Alternative – WP Advanced Search

WP Advanced Search is not a plugin as it sounds like. Instead, it is a free PHP framework that helps you build a custom faceted search tool. Even if you are not professional in coding, you can make use of the framework to implement fully functional faceted search to your WordPress site, as long as you:

  • Know how WordPress functions.
  • Want to practice some PHP skills.
  • Have enough time and the patience for experiments.

As a good-to-use framework, WP Advanced Search has already included the necessary facet functions and the search feature. By pulling the different pieces in the framework together, you will get a faceted search tool that works in the exact way you want.

Here is where its charm lies – you can get full control over the search form and search page template. You may not enjoy the same flexibility in any existing WordPress plugin.

WP Advanced Search

Get started with WP Advanced Search

Since WP Advanced Search is free, you can download it immediately from GitHub. However, before taking it into use, we suggest you do the following things first.

  • Create a staging environment for your WordPress site. To use WP Advanced Search, you will have to edit the theme files. In order to prevent your site from breaking down accidentally, you should complete the development on a staging site, test it well, and then implement the faceted search tool on your production site. You should never try the framework directly on a live site.
  • Create a child theme for the active theme. Child theme allows you to make changes without affecting the code of the original theme.

After finishing the tasks above, you can install the framework to the active theme. Firstly, you need to upload the zip file to the directory of the active theme. Secondly, exact the zip file. Thirdly, rename the new file as “wp-advanced-search”.

Add WP Advanced Search File to Theme Directory

And at last, add the following code to the functions.php file of your theme, just after the opening <php> tag. When this is done, you have completed the installation.

Install WP Advanced Search in Active Theme

Configure and use WP Advanced Search

To get the faceted search tool to work, you should at least finish the following three tasks right after installing the framework. All these tasks require some coding knowledge, and you may need to create PHP files. But thankfully, the framework’s well-made documentation provides some sample codes that you can use to simplify the process.

  • Create a search form. This can be done by adding a search function in the functions.php file of your active theme. If you only want a basic form, you can simply copy the code offered in this setup instruction.
  • Create a page template to display the search form.
  • Create a template for search results. This step is necessary if you display search results on a separate page.

These tasks sound difficult. However, beginners can simplify all of them by making use of the three search demos offered by WP Advanced Search. These demos demonstrate different implementations of the framework.

WP Advanced Search Demos

You can view the demos on live sites, and if you want to make a faceted search tool that is similar to one of them, make sure to view the source code.

View Demos

The source code covers all of the search form, page template and results template, so you can get your work done by copying and modifying the code. Just remember to save the templates as PHP files and upload them to your theme directory.

Source Code

Test the search form and apply it to your live site

When all the theme files are in the right place, you can create a page with the new search template to test the search form. If there is no error, the search form will be displayed properly on the page. Then you can publish the page and test the faceted search tool by yourself.

Use New Search Page Template

After styling the search form and making sure everything is right, copy the needed theme files from the staging site to your live site to implement the faceted search tool. But remember, you should always back up your live WordPress site before making any significant change.


Joyce is a professional writer & SEOer who loves trying new things and sharing the experience through blogging. She loves clean design, playing with different WordPress themes, SEO, etc. Now she is very struggle with purchasing a bubbling apartment in downtown. You can help her by clicking our ADs or making a purchase via our links ;-)


Want to Learn More About WordPress?

Get Our Free Themes, Plugins, Support, SEO Tips, and Other Tutorials!

Email *