How to Add Ajax Taxonomies Filter in WordPress Search

We all know that the default WordPress search is not very good. However, if you could allow users to filter results based on categories and tags, custom taxonomies, or post types, then this will help users find content more easily. Previously we showed you how to add this kind of advanced search form in WordPress. In this article, we will show you how to add an Ajax powered taxonomies filter in WordPress search.

Why use Ajax Taxonomies Filter in WordPress Search?

Ajax powered search is faster and provides a better user interface. For example, a car dealership website may have custom taxonomies for different vehicle types, price ranges, models, etc. This interface can help users find exactly what they need. It also helps website administrators to organize their content, so that it could be easily found by users.

First thing you need to do is install and activate Ajax WP Query Search Filter plugin. Upon activation, it will add a new menu item β€œAjax WPQSF” in your WordPress admin sidebar. Clicking on it will take you to the plugin page where you can click on the Add New Search Form button to build your search form.

First you need to provide a title for your form this will be used to recognize your form internally, as you can create multiple search forms with this plugin. After that you can choose post types this search form will look into. You will see the default WordPress posts and pages along with any custom post type you may have on your site.

Next option is to choose a taxonomy. You can choose the Boolean relationship between taxonomy queries. For example, if a user selects flowers and pets, would you want the plugin to match both terms or display the result if either one of them is found. The next option is to add a taxonomy, to do that you need to click on the Add Taxnomy button.

A new popup would appear and you will see category and any other custom taxonomy you may have on your site. You can add a label for the taxonomy. You can choose to hide empty terms. Lastly choose a display type for your taxonomy terms. You can display them in checkboxes, dropdown menu, or radio buttons. After selecting custom taxonomy, you can further fine tune your search form by adding custom meta fields just like you added taxonomy.

The next tab is for result settings and other options. On this tab, you can add a traditional keyword search box and here is the catch. If a user selects a taxonomy or custom meta field and enters the keyword, then the plugin will run search query for the keyword and will ignore taxonomy and custom meta field selection by the user.

That’s all. Now just save your search form, and you will see a shortcode. You can add this shortcode in any post, page, or text widget on your site to display the search form.

We hope this article helped you add Ajax powered taxonomy filter in WordPress search on your site. Using this advanced search and sorting feature can help you create simple but very efficient sort and search filters on your WordPress site. For questions and feedback please leave a comment below.

Leave a Reply

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

error: Content is protected !!

Pin It on Pinterest

Add address