Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Add Ajax Taxonomies Filter in WordPress Search

Last updated on by
Follow WPBeginner on YouTube
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.

Ajax powered search form with taxonomy filters

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.

Add new Ajax Search Form in WordPress

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.

Ajax search filter settings

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.

Adding taxonomies to the Ajax search filter in WordPress

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.

Adding a keyword search form in Ajax search

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.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »
  • realmag777

    And one more thing – qTranslate friendly!+

  • James

    Thanks for the recommendation. I went to install this plugin and found that the plugin author is no longer updating Ajax WP Query Search Filter.

    Instead, he’s rolled this plugin into his newer one (which he’s still supporting): Ultimate WP Query Search Filter http://wordpress.org/plugins/ultimate-wp-query-search-filter/

    • http://www.wpbeginner.com/ WPBeginner Support

      James, thanks for notifying us.

  • Mohammed Debashi

    Can this plugin do search filters for a category, and its children. not sure if I am explaining myself properly. but something along the lines of Country -> State -> City..etc

    Also is it compatible with WPML

  • Mike

    Hey, thanks for this! Quick question: I’m having trouble applying jQuery stuff like tooltips to the AJAX content loaded, I guess because it only applies to content loaded upon initial page load. Any ideas on how to make the AJAX content get recognized? Thanks!

  • Thomas

    Hi,

    Which template file this plugin is looking for when displaying restults ?

    Thanks !
    th.

  • Zakaria

    Hello!
    I think Advance WP Query Search Filter is a lot better.

  • Piet

    Cool, is the Ajax WPQSF plugin compatible with Relevanssi?

    • http://www.wpbeginner.com/ WPBeginner Support

      We haven’t tested it with Relevanssi so we can’t say for sure.