How to Add Facet Filters to a WordPress Site

Filtering data sets easily is one of the things that sets a quality website apart from the crowd. It’s what makes users think hey this works, this is simple, this is easy and I’m finding what I need. Everything else being equal, the site that implements facet filters well is going to have a significant advantage over their competitors in the same space.

You’ll find facet filtering on most large websites with data sets that are too big to consume all at once. The term facet filtering just means that the filters are capable of working together, which is what users expect today. Almost all filtering today is facet filtering, but there are some cases where we see filters working alone so the distinction is still (somewhat) meaningful. A classic example of a facet filter is on a real estate site. You might start by choosing “apartments” as the property type, and that narrows the listing result down… to about 3,000 available apartments… better set a price limit because those $50,000 a month penthouse rentals look nice… but that ocean view would distract me from my work… oh and I better choose between rental and buy as this makes a big difference as well.

Now let’s talk about the technical aspects of facet filtering, as it applies to WordPress sites. If the content you want to filter is a singular post type, which could be “posts” or “pages”, those are examples of the 2 public and default post types… or they could be 3rd party (installed by a plugin) such as WooCommerce products, or they could be custom built for your site by your own developers. One of the reasons WordPress originally rose to the top spot as a CMS (Content Management System) is because of it’s simple and centralized approach to custom content types. Today many other CMS systems are modelled after WordPress in this area, but not all make it as fast and simple to register different content types, or provide as much functionality based on content types. For instance content types are powerful in WP because they work in conjunction with taxonomies (categories and tags) to create meta organized content. That can then be leveraged by developers through the use of taxonomy filtering.

If your content is stored in a custom database table, which means it does not conform to the “WordPress way” of building out custom content, then you probably won’t have taxonomies for it, and you won’t have access to the some of the WP Query handling that is provided by default. In fact (for better or worse) your custom content is in many ways not integrated into WP, but instead just sits on top of it. Which is in some cases fine, or even preferred, but this is a decision WordPress site developers and site owners have to make carefully early on in the site development process. It does have ramifications later on. For example the downside of using WP’s native post type system is that if the data has a lot of meta fields, it may overwhelm the database with records and slow down the site due to complex queries when fetching that meta data. And this is particularly relevant here when we discuss facet filters, because the most simple way of implementing filters is to provide a taxonomy based filter where the taxonomy terms become the filtering options. This is very well support by the WP Query class (a PHP class) that is used to fetch content natively by WordPress.

Custom Code or WordPress Plugin?

Now let’s take a step back and ask the big question, are you cut out to build or implement (via a developer) custom facet filtering on your WordPress site? Because this question is important before you get in over your head. This author has 17-years programming experience, and would rank filter building as one of the more challenging and complex aspects of programming that a developer can do. If we gave this task to a novice or even most intermediate developers, the results might be quite problematic. There is a lot of risk of performance issues, inconsistencies, buggy functionality etc. This is not standard and simple programming, instead it’s system design. What a filter needs to do is first render out options, then respond to the user interaction, then trigger queries, then reload content, and then be ready to do that same cycle again, or to reset the loading of content. All of this functionality really takes a lot of testing to get right. This is not to deter someone of course from taking on the challenge, if you start with a solid plan, if you study how existing filters work, you can create something on a custom basis for a project, and maybe even create a reusable plugin filter that adds to the limited number of options in this WordPress plugin category.

Overview of Filtering Plugins for WordPress

Now let’s suppose you want a turn key approach, install a plugin, configure it, get it working. What are your options? Fortunately there are some options that will work in many situations and these are supported by reputable WordPress plugin developers. One option that is relatively new but has been well received by many in the WordPress community is JetSmartFilters. This is made by Crocoblock’s, which rose quickly in the market with JetEngine and it’s suite of plugins for Elementor. They have since shifted to Gutenberg support in addition to Elementor, but as of this moment you will need to use Elementor to get the filtering support provided by JetSmartFilters. This is also a premium plugin, most developers who use it are probably using JetEngine and other compatible Crocoblock’s plugins.

Another premium plugin that provides filtering support for WordPress is FacetWP. This plugin has been around for a long time and is fairly widely appreciated by developers. It is arguably the market leader in filtering for WP, but as a premium plugin we can’t really see it’s usage figures in comparison to the other options. FacetWP has an impressive number of filtering types. They have been around long enough to have refined their plugin based on real users requesting changes and features, and this shows in the diversity and depth of their feature set.

Our third honorable mention for filtering plugin options is Search and Filter. This is a unique plugin because it’s only one we can find in this category that has a completely free option listed in the WordPress plugins directory. Unfortunately that free version does have some pretty big constraints that might make it more of a demo version than something you would really use on a production website. Of course the developers product here is the Search and Filter Pro version, and this is what is commonly compared to FacetWP as these plugins battle it out for the top spot in this category.

Another relatively new option for WordPress filtering plugins is ACF Engine. With it’s selection of dynamic ACF blocks for Gutenberg, ACF Engine provides 2 blocks for filtering. The first is it’s Taxonomy Block, which turns any taxonomy into a filter. The second is the meta filter which allows you to use your custom fields from ACF as filters.