How to Add Fuzzy Search to Your WordPress Site

Do you want to add fuzzy search to your WordPress site?

A fuzzy search process makes your site look for search results in a more flexible way. If you enable it, your site will show results that are similar in spelling to what the user typed in the search bar. This can help you improve your site search and get more sales.

In this article, we’ll show you how to add fuzzy search to your WordPress site the easy way. This method is very easy to follow, even for newbies.

Let’s dive in!

What Is Fuzzy Search?

By default, all WordPress websites use a strict search algorithm. This means your site search will only look for exact matches of the keywords a user types into the search bar. This type of rigid search algorithm is often good enough for most sites.

But in other cases, you may need to make your search algorithm less rigid.

By adding fuzzy search to your site, your search results will now show terms close in spelling to what the user types into the search form. This is also called partial matching.

When setting up your fuzzy search algorithm, you can control how you want your site to check for close matches. For example, you can configure your site to only show results that have the searched keyword as a suffix.

So, if a user searches for the term, “ball”, your site will also show results for “baseball”. But it will not show results for “balloon”.

You can also set it to consider typos when looking for search results. So, if a user mistakenly types “WordPres”, your site will show results for “WordPress” too. This means your site users will see the “No Results” page less frequently.

WordPress fuzzy search example

Fuzzy search can be very effective for certain types of searches like academic research. For this type of search, it’s important to get results for terms similar to the search term in different ways.

With fuzzy search, your site may show less relevant or precise search results. But it can now give many results that are likely to be relevant to the user.

Let’s look at some of the most common reasons why you may want to add fuzzy search to your WordPress site. Or, you can click here to skip ahead to the tutorial.

Why Add Fuzzy Search to WordPress?

Fuzzy search is a search feature that can either improve your site search or make it worse. You should only add this feature when you’re sure your site needs it. This depends largely on the type of site you have and how you configure the fuzzy matching process.

Fuzzy search widens the scope of your search process. If you don’t use it properly, your site search will end up with lots of unwanted results. This can make your site search less effective and reduce customer satisfaction.

Here are some popular use cases when fuzzy search can be helpful:

  • An academic research archive. Most academic researchers are looking for a general idea rather than a specific technical term. Fuzzy search will help them find a wider range of results that may possibly match their search intent.
  • Sites containing translated documents or content in foreign languages. Finding translated documents or content in foreign languages can be quite challenging. With a more flexible search algorithm, your site users can find what they need faster.
  • Sites with many failed searches due to common misspellings. If most of your site searches fail due to common misspellings like “grey” and “gray”, then you need fuzzy search. Site users can also use fuzzy search to find people like authors that they easily misspell their names.

The best way to know when to use fuzzy search is to gather statistics about your site search. You can use this information to evaluate if and why your site is showing users no results. If you have a lot of failed searches, then you can add fuzzy search to improve your search.

You can use a WordPress plugin like SearchWP to monitor your site search activity.

SearchWP site search statistics

These insights will help you decide whether your site needs fuzzy search or not.

Now, let’s talk about how to actually add fuzzy search to WordPress.

The easiest way to add fuzzy search to your WordPress site is to use a plugin like SearchWP. This method is faster than adding custom code to your site. It will also cost you less time and you don’t need any technical knowledge to do it.

SearchWP best WordPress search plugin

SearchWP is the best WordPress search plugin. You can use this tool to add fuzzy search to your site by simply checking a box in the plugin’s settings.

SearchWP allows you to control how your site looks for search results. Over 30,000 active websites use the plugin to boost the average time spent on their site and product discoverability.

You can also use SearchWP for:

  • Complete site search. SearchWP helps your site look for search results everywhere. Site users won’t miss keyword matches in important locations like custom fields and product tags.
  • WooCommerce integration. With SearchWP, visitors can also find products faster in your WooCommerce store. The plugin looks for search results in product tags, categories, shipping classes, and even variations.
  • Exclude attributes from results. Want to make search more specific? You can also use SearchWP to exclude certain attributes or content sources from your search results.

The good thing with SearchWP is that once you install and activate it, it integrates automatically with your site. It will then replace and improve all your WordPress search forms.

You can use the plugin to set up WordPress fuzzy search in 3 simple steps. Let’s show you!

Step 1: Install and Activate SearchWP

To add fuzzy search to WordPress, we’ll start by grabbing a copy of the SearchWP plugin here.

After getting the plugin, you can click any of the 2 links available to download a version of the plugin. We recommend the latest version for the best performance possible.

SearchWP product download links

After grabbing your copy of SearchWP, you’ll also get an email containing your product license key. You can save it to a notepad for reference when it’s time to activate the plugin within WordPress.

Next, log into your WordPress dashboard and upload the SearchWP ZIP file to your site.

You can check this detailed guide on how to install a WordPress plugin for more information on that.

Now that you’ve installed and activated the plugin, it’s time to activate the license.

You can do this by clicking the new SearchWP button on the top panel of your WordPress dashboard.

go to SearchWP settings page

Next, navigate to the License tab and enter the license key you got in the email. After entering the key, click Activate.

Activate SearchWP license

Congratulations! You’ve installed the SearchWP plugin and improved your site search.

The next step is to enable fuzzy search on your site.

Step 2: Enable Fuzzy Search in SearchWP

Now that SearchWP is active on your site, you can simply add fuzzy search by enabling it in the advanced settings.

First, click the SearchWP button in the top bar of your WordPress dashboard.

go to SearchWP settings

Next, navigate to the Advanced tab and check the box next to Partial matches.

Enable WordPress fuzzy search with SearchWP

You’ve now successfully added fuzzy search to WordPress!

But SearchWP also allows you to customize how your site looks for similar terms during fuzzy matching. Let’s show you how to do this.

Step 3: Customize WordPress Fuzzy Matching

SearchWP allows you to customize your site’s fuzzy search process in different ways. You can do this by adding some code called ‘hooks’ to your site.

The process is very simple if you use a WordPress plugin like Code Snippets. You can use this step-by-step guide to learn more about how to add custom code snippets in WordPress.

There are 2 levels of partial matching (fuzzy search) you can add to WordPress using SearchWP. We’ll show you how each level works and give you some examples.

Level 1: LIKE

In this level, SearchWP will try to look for partial matches for the exact keyword typed in the search bar. It doesn’t try to adjust for typo errors or look for alternative spellings of the keyword.

You can customize the search engine to add partial matches either as a suffix or prefix. For example, you can set up a suffix-only partial matching using this code below:


// Tell SearchWP not to use a wildcard prefix when performing partial match logic.
add_filter( 'searchwp\query\partial_matches\wildcard_after', '__return_false' );

The code snippet will look like this in your WordPress dashboard.

Suffix only WordPress fuzzy search partial matching

For example, this means your site will not return results for “WordPress” if a user searches for “Press”.

Search results for suffix only fuzzy matching

But it’ll return results for “WordPress” when the user searches for “Word”.

SearchWP returns search results for suffix only partial matching

Now, let’s talk about the second level of partial matching SearchWP offers.

Level 2: Fuzzy Matching

This level is the most flexible type of fuzzy search. You can use fuzzy matching when SearchWP can’t find both suffix and prefix partial matches. For this level of fuzzy search, SearchWP will consider common misspelling errors.

The search engine will scan your search index for terms close to the search term. For example, if the user types “socker”, your site will return results for “soccer” as well.

With this level of fuzzy search, your users are more likely to see unwanted search results. But you can also customize how the search engine looks for fuzzy matches using code snippets.

For example, you can use the code below to adjust how strict you want fuzzy matching to be. You can do this by setting a numerical threshold for the search engine.


// Make SearchWP's fuzzy matching more strict.
// The scale is 0-100 going from furthest match (lowest, 0) 
//        to closest match (highest, 100).
add_filter( 'searchwp\query\partial_matches\fuzzy\threshold', function( $threshold ) {
  return 80;
} );

The threshold value ranges from 0 to 100. The default threshold is 70. If you set the threshold value to 100, the fuzzy search algorithm will be very strict. You’re more likely to receive unwanted search results if the threshold value is very low.

For example, at the default threshold, your site will return search results for “soccer” when you type “socker” in the search bar.

SearchWP fuzzy matching results at default threshold

But at the highest threshold (100), your site won’t return any results for the same keyword.

SearchWP fuzzy matching results at the highest threshold

For more details, you can find all the available SearchWP fuzzy search hooks here.

In this article, you’ve learned how to add fuzzy search to your WordPress site.

Using this feature, your site will return search results with terms similar to the user’s search term. This can help your users find more relevant results and stay longer on your site.

Ready to add fuzzy search to WordPress? Get started by getting your copy of the SearchWP plugin here.

You can also check out our guides on how to make a search bar that searches your site and how to add WordPress search by category.

Want to make your search awesome right now?

More than 30,000 sites have chosen SearchWP!

You can utilize all of the content that’s gone unrecognized by native WordPress keyword search instantly with SearchWP.

Get SearchWP for just $99

  • Committed Support
    If you need help, support is fast, friendly, and here for you
  • Streamlined Setup
    Installation and setup that’s optimized for speed
  • Great Documentation
    Helpful, clear, and usable documentation is a priority

See what SearchWP customers have to say

  • “Outstanding support. We were able to get really good tailored search results using SearchWP. Give it a go and if you get stuck, use the FAQs and support and you’ll be fine.”

  • “SearchWP lets you easily configure a custom search engine placing more or less emphasis on whatever fields and post types that you want. Very clean interface. Super helpful plugin. Thanks!”

  • “Easy to setup and tweak to your needs. Hooks and filters make it easily extendable.”

[wpforms id="3080"]