How to Add a “Search by Categories” Feature in WordPress

How to Add a “Search by Categories” Feature in WordPress

Allowing the users to search your posts by category is one of the proven ways to improve your website’s UX, as the users get to navigate your website faster and with greater ease. This type of search is particularly useful on bigger websites with lots of diverse content as it allows users to search in a specific category instead of the entire website, and get more exact results.

Nevertheless, the “search by categories” feature can also prove to be quite effective on smaller websites as long as the content is nicely split into adequate categories. The primary purpose of categories, which are part of the default WordPress taxonomies, is to make it easier for your users to find what they came to your website for, so practically any type of website, regardless of the size, scope and nature, can benefit from this feature.

In this article, we will show you how to add a “search by categories” feature to your website all by yourself, with a free plugin and without any additional investments, in just a couple of steps. But, bear in mind that your website will benefit from this feature only if your content is well-organized in categories.

Qode Themes: Top Picks
Bridge New Banner

Creative Multi-Purpose WordPress Theme

Stockholm WordPress Theme

A Genuinely Multi-Concept Theme

Startit WordPress Theme

Fresh Startup Business Theme

About WordPress Categories and Subcategories

Before we jump to explaining how to add the search by category feature to your site, let’s just briefly remind you why splitting the content into categories and subcategories is useful and how many categories is best to have.

About WordPress Categories and Subcategories

Apart from the obvious benefits of having a well-structured website, like improved user experience, better bounce rates, and similar – another possible advantage of introducing categories to your posts and pages is improved SEO. This is especially the case when you manage to use the right keywords to name the categories.

The number of categories you can have on your website is not limited, but the practice shows it is best to stick to a few. Too many categories give off just as messy and cluttered an impression as a website with no categories at all. Five to ten categories have proven to be the optimal number and if you are just starting out you’ll probably be fine with three categories to begin with. It’s also important to avoid categories that include only a few posts as a category is usually constituted of a large number of posts that cover related topics. And in case you want to classify your posts better, you can also add subcategories. A fashion website can, for example, have the swimwear category, where one-piece and two-piece swimming suits will be two subcategories.

When you are sure you have organized your website well and sorted your content into categories properly, you are ready to add the “search by categories” feature to your website.

How to Add a “Search by Categories” Feature Using a Plugin

Ivory Search is an excellent, free plugin with stellar ratings and more than 70,000 active installations. User-friendliness, simplicity, and efficacy are the core features that made it popular for such a large number of users. With this advanced plugin, you can easily add an unlimited number of search forms anywhere on your website. It allows you to configure each form individually so that your users can perform a variety of different search types on your website.

To install it, follow the routine installation procedure, typical of any other WordPress plugin. In case you need some assistance, you can always take a look at our detailed guide on WordPress plugin installation.

Ivory Search

After you installed the plugin, you will notice a new menu item in the lefthand menu – Ivory Search. Click on the Search Forms option to go to the plugin’s options page and then click on the Add New Search Form button.

Add New Search Form

The next step is to build your new search form. The first thing you need to do here is to come up with a name for your search form and enter it in the designated field. This name will not be visible anywhere else but in the admin panel and its purpose is purely administrative.

Insert Name

Before you save the new search form, you need to adjust some settings. First, go to the Post Types option, click on it for the menu to expand and then choose what type of content you want to add to the search. You can select posts, media, products, pages and templates.

Post Types

After you made your choice, go to Posts option, click on it for the menu to expand, and turn on the Search posts of only selected taxonomies toggle. This is necessary as it allows you to choose the WordPress categories you can add to the search.

Selected Taxonomies

After you have selected a category or a few of them, it is time to click on the Save Form button.

A new custom shortcode for the new search form is automatically created and the next thing you need to do is to copy and paste it into a text file.

Save Form

This shortcode allows you to add a category search wherever you want on your website – page, post or widget area. For example, we added it into a post, and this is how the result looks like:

Search Form Preview

Now, it is important to understand that you can use this newly created shortcode as many times as you find it necessary, and in any area of your website. In case you don’t have experience with shortcodes or don’t feel comfortable using them for any other reason, it might be a good time to learn a bit about shortcodes in WordPress.

Every user who uses this search form on your site will only have access to view posts within the selected category.

Search Results

This plugin allows you to create multiple category searches. To add more category searches, simply repeat the procedure described above to create new search forms and generate new shortcodes that you will then embed into your WordPress website.

In Conclusion

Not only does the search by categories make the user experience better, but it also shows that you invest effort into managing your content and making your website user-friendly. Practice shows that this feature is particularly useful in certain types of sites like e-commerce websites and websites that offer a lot of downloading material.

Since WordPress is generally known for not having a particularly good inbuilt search functionality, maybe you should also consider adding the general search feature to your WordPress site – it is easily done with the help of excellent WordPress search plugins.

Post your comment