How to Add Autocomplete Search to Your WordPress Site
An autocomplete search bar is everywhere these days. If you use a search engine, chances are that it often recognizes what you’re looking for before you can finish typing and will start showing you suggestions to save time.
Although WordPress includes search functionality out of the box, it doesn’t natively support ‘autocomplete search’ or ‘live search’, which are the two most common names for this feature. With the help of the right plugin, however, you can implement a search box easily.
In this article, we’ll introduce you to three WordPress autocomplete search plugins you can use, and how to get started with each of them. Then we’ll talk about how to implement autocomplete search in WordPress manually. Let’s get to work!
Why Does Autocomplete Search Matter?
These days, users expect to find the answers they need quickly. As search engines grow more and more accurate, people get used to finding the pages and content that match their search query with minimal effort required.
That’s why it can be a jarring experience to jump from a powerful search engine to using a website’s internal search functionality. Although WordPress’ search feature works well enough out of the box, it lacks some of the advanced options that most visitors have become accustomed to using, such as autocomplete.
This is where autocomplete search suggestions come in handy. By implementing WordPress search suggestions, you increase the chances that users will spend more time on your site. You make it easier for them to find the content they want, which results in a better overall experience. Plus, it’s not hard to implement WP autocomplete search if you’re using the right plugin.
How to Add Search to Your WordPress Site with a Plugin
There are a lot of WordPress search plugins you can choose from, but not all of them include the autocomplete feature we’re after. For this section, we’ll focus on three of the best options you can use and show you how to enable predictive search with each of them.
Enable Autocomplete in WPSolr
WPSolr is a premium search suggestion plugin that works with both regular WordPress and WooCommerce websites. It’s powered by the Elasticsearch and Solr platforms, and enables you to customize search results from one site to another.
If you like plugins that include as many customization options as possible, you’ll probably appreciate WPSolr. The only downside to this plugin is that it’s expensive. On the plus side, it makes enabling live search simple.
Once you install the plugin, you’ll get access to its settings page inside the dashboard. If you navigate to the tab that reads Define your search with Elastic.co – GCloud, you’ll find an option called Show suggestions in the search box.
When you enable this feature, users will see full page titles plus part of those pages’ content right within the search bar, before they even submit a query. That way, they can select the result they want immediately, without having to sort through a full list of options.
Price: A WPSoler license costs €199 per year (about $215 per year).
Enable Autocomplete in SearchWP
SearchWP is all about helping users find content that WordPress’ default search functionality doesn’t recognize. Out of the box, the plugin supports custom field data, shortcodes output, taxonomies, and even WooCommerce product details.
However, SearchWP doesn’t include autocomplete search functionality by default. To enable that feature, you’ll need to use a free extension called SearchWP Live Ajax Search.
All you have to do to enable autocomplete search is activate the extension. It will do the rest for you automatically.
It’s also worth noting that SearchWP Live Ajax Search works without the base SearchWP plugin. The only difference is that when combined with SearchWP, you get access to more in-depth results.
Price: A standard SearchWP license for one site costs $99, but the Live Ajax Search extension is free.
Enable Autocomplete in Ajax Search Lite
Out of the box, Ajax Search Lite offers features that you usually only find in premium WordPress search plugins. With this tool, your users can access WordPress autocomplete search results that include custom post types, fields, and other kinds of metadata (along with the default page and post results).
Once the plugin is active, you can navigate to Ajax Search Lite > General Options > Autocomplete & Suggestions. Autocomplete search should be turned on by default, under Turn on google search autocomplete?.
If you want full control over what type of content appears in autocomplete results, go to the Sources & Basics tab. There, you can choose what content will show up in your search results.
All the autocomplete search functionality you’ll need is available in Ajax Search Lite’s free version. However, there’s also a premium version of the plugin that includes additional features, such as custom themes for your search bar and results.
Price: Ajax Search Lite is free, while the premium version of the plugin starts at $36.
WordPress Autocomplete Search Without a Plugin
How to Add Autocomplete Search on Your Own
Adding autocomplete search functionality to your website manually requires you to work with some code, as you might expect. However, there are different ways you can approach the project, with varying difficulty levels.
Here are the two approaches we recommend exploring:
- Implement live search with Ajax for post titles only. Since you’ll only be fetching post titles, this is the easiest method of implementation.
- Add autocomplete search for custom tables. With this method, you can serve results from a custom table you create, giving you full control over the data that appears.
In either of those scenarios, you’ll probably want to implement the code you use in plugin format. That’s because with a plugin you can disable or enable the code at any time, which is perfect if you’re going to customize this functionality in the future.
Improve Your Digital Experiences With WP Engine
Implementing autocomplete search in WordPress is easier than you might expect. With the right plugin, you can make it much simpler for visitors to find what they’re looking for, and improve their experience.
Of course, this won’t mean much if you’re not using the right web host as well. Managed WordPress hosting grants you unlimited access to tools and 24/7 support from technical experts to maintain optimal site performance. With WP Engine, you get all the resources you need to grow your website and provide your visitors with a top-quality WordPress hosting experience!