When you search on a regular search engine like Google, it’s highly unlikely that you’ll come up with no results (unless you search for something utterly nonsensical, but even then…). However, this can happen more regularly than one would like when using a WordPress website’s internal search function.
Many of your website visitors will want to find more information about you, your business, or your products. If they hit a blank page after typing a query into your search bar, however, chances are they will leave your site. This is especially true if they are used to Google or a similar search engine.
Internet users expect certain features from the websites they visit. It’s important that you work with their expectations when it comes to searching. Having a custom search page that includes the items they’re used to will help keep them interested and engaged in your content.
In this post, we will discuss what search results pages are and why they’re important. Then, we’ll outline how to customize your WordPress results page to include the functionality your readers expect to see. Let’s get started!
What are WordPress Search Results Pages?
When one of your readers types a word or phrase into the search box on your WordPress site, they’ll see a page listing all the content that matches their query. This is known as a search results page. Of course, an internal search results page is different from the results you would see on a search engine like Google. For one thing, the internal page will only list items that are available within your site, rather than across the entire internet.
An internal search results page is important for any site that features text content and is accessible through standard search engines. Generally, one of three things will happen when someone lands on your site from a basic internet search. They will immediately find what they are looking for, they will use your built-in search to find the information, or they will leave your site. Therefore, your chance of keeping readers on your site relies on their ability to find what they are looking for quickly. Enabling visitors to search and view results on your site is one of the easiest ways to keep them around for longer.
Why to Customize WordPress Search Results Pages
Visitors come to your website with certain expectations. While they aren’t looking for the same results they would get from Google, they may expect to see similar features. This can include suggested spellings, content suggestions based on their initial search, and more.
Having a customized search results page can keep your readers engaged with your site and its content, even when their searches come up dry. Plus, you’ll be providing your readers with everything they expect from a standard search engine. By mimicking popular search engines, you can also lower bounce rates on your site.
If done correctly, a custom results page offers several additional benefits. It can:
- Help visitors find what they are looking for
- Keep visitors on your site longer
- Offer related information searchers may not have known they needed
- Show some personality
- Show you care about the little things, including being helpful
In the end, customizing your WordPress search results to more closely imitate a traditional search engine creates value for you and your visitors. Best of all, you can accomplish it easily through the use of plugins!
How to Customize Your WordPress Search Results Pages
The versatility of WordPress enables you to easily customize your search results. You can use code to alter the search.php file, for example, or you can use a plugin. We recommend the latter approach, as plugins are easier for most WordPress users to install and maintain.
There are several options you can use to customize your internal search results pages. While you could always dive into the search.php code (though this is best left to experienced users comfortable with PHP and CSS coding), there are several plugins you can use to implement simialr changes. Finding the functionality that works best will depend on you and your site. Small personal sites may benefit from free plugins, while larger sites might need a premium solution.
As always, we also recommend that you back up your WordPress site before making any updates or changes. Let’s dive in!
1. Include or Highlight the Search Term as a Reminder of the Original Search
One of the best tips I’ve ever heard about internal site search results pages is the closer you can make them look like standard Google search results pages, the better. One way to do this is to include the search term your visitor searched for at the top of the search results page. This is a simple technique to show visitors a search did occur even if it came up empty (and perhaps a typo was the culprit). It also enables your readers to double check that they entered the right phrase, and that they spelled the words correctly.
Search & Filter is a free plugin that works with the default search function for WordPress. It will enable users to search every non-password protected page on your site. In addition, it offers functionality that makes it possible to feature the search term at the top of results pages, or even provide users an option to order search results (note this is in the Pro version).
Include the Search Term on Search Results Pages
To do this manually you will need to start by creating a child theme (if you’re not sure how, checkout our guide on how to create a WordPress child theme).
Next, create a search.php file in your brand new child theme and copy over the code from your old theme (you can find this by either opening up theme files on your server via FTP, or from your WordPress dashboard under Appearance > Editor > Search.php). Now you can replace the default title in your child theme’s search.php with the following:
<h1 class="search-title"> <?php echo $wp_query->found_posts; ?> <?php _e( 'Search Results Found For', 'locale' ); ?>: "<?php the_search_query(); ?>" </h1>
This will display the title with the count of the posts found followed by the term that was searched. So it would look something like “15 Search Results Found For: My Search Query”.
Highlight the Search Term in Results
Another thing you might want to do is highlight the search term in the search results. This way, when visitors to your site are presented with search results, their search term is highlighted within the individual results. The plugin Highlight Search Terms serves this role well. It’s simple but can help direct your visitors more specifically to what they’re looking for.
2. Add Suggested Spellings in Case of Typos
Thanks to the popularity of Google and other search engines, most site visitors expect to see spelling suggestions when they interact with your search function. Adding this feature to your results pages improves the user experience, by helping them find what they’re looking for even if they don’t know how to spell it.
With over 100,000 active installs, Relevanssi is one of the most popular WordPress plugins for search. Rather than using WordPress’s default functionality, Relevanssi replaces the search feature altogether. Its free services are perfect for small or personal sites, while the premium version offers amazing functionality for large and multi-site managers. In addition to its suggested spelling feature, this plugin provides an array of options, including the ability to search tags, comments, and categories.
3. Add Suggested Pages to Maintain Interest in Your Site
One of the best ways to use your results pages, aside from providing the searched-for information, is to serve up content that is similar to what users are looking for. If you have ever searched Amazon for a product, you’ve probably seen suggestions for other products based on that search. This method of putting valuable content in front of visitors can boost the amount of time they spend on your site. And by suggesting pages for readers to go to – even if it’s not related to their search query – you can do a lot toward decreasing your bounce rate.
If you are looking for search functionality that behaves the way Amazon or eBay does, a simple option we recommend is the Better Search plugin. Once installed, you can insert a heat map for your most popular searches in the form of a widget. This will ensure visitors will be presented with plenty of options for where to go next.
4. Add a Search Box
Another way to keep people on your site and engaged in their searches is to add a search box on the search results page if there isn’t one already included in your theme. This is especially helpful if no results are returned and you wish to prompt users to try a different search query. An easy way to add a search box is with the free Ivory Search plugin. While this plugin has grown to include many search features, it’s still just as easy to install and use the plugin settings to customize your search form and results.
You can also add a search box directly to any page (via your child theme, as mentioned above) by using the core WordPress function “get_search_form();”.
<?php get_search_form( true ); ?>
This will display the searchform as defined by the searchform.php theme file or if one doesn’t exist WordPress will output HTML for a standard search form. You can learn more at the CODEX.
Or, if by chance you are using a block based WordPress theme, you can simply customize your menu by adding in the Search block.
To do this, go to Appearance > Editor > Template Parts > Header then insert the Search block. It’s that easy with Gutenberg’s full site editor.
Which ever option you choose, a menu search will make it so your visitors have no excuses for getting off track on your site. When you’re always steering them back in the right direction, you ensure you’re doing your part to enhance people’s experience on your site. And I can assure you right now, that kind of attention to detail doesn’t go unnoticed or unappreciated.
5. Ajax Your Search
The last option we want to mention today to keep readers engaged with your site is to add Ajax search results so your readers can use a “live” search. The free Ajax Search Lite plugin allows users to search your site with results updated as they type. The plugin includes added options for category filter, Google autocomplete and keyword suggestions.
For more options consider upgrading to Ajax Search Pro. The premium version of the plugin adds support for bbPress, BuddyPress, WooCommerce and JigoShop so users can search all of your custom post types. Plus there are features for caching, custom fields, 100+ design themes, 4 layouts and lots more.
Or consider using Toolset Search. In addition to support for Ajax search results, the plugin adds tons of other options for filters, map based results, grid and list layouts, pagination and more.
While many WordPress users think to add the search widget to the sidebar of their sites, a lot forget about what the output of such searches will be. And that’s a major oversight.
You want to make sure every single page of your site is working hard for you – even the search results pages. While most readers may be interested in your home page or core offerings, they probably come to your site looking for something specific. Although your site is likely not a search engine, it’s best to provide the help and functionality visitors are accustom to. You never know how a single page can affect individual users. Present the right visitor with the right information at the right time and you stand to not only keep that visitor on your site for longer but also turn them into a loyal customer.
Have you done any customization on your search results pages? If so, what’s worked best for you? What have you found to be the most effective addition? As always, let me know in the comments.