How to Customize Search Page Results in WordPress

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 WordPress Search Results Pages Are (and Why They Matter)

screenshot-wpexplorer-search-results

Here you can see our own search results page for the term “SEO plugins”.

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 You Should Customize Your 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

Search Everything Plugin

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 Everything 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, if offers functionality that makes it possible to highlight search terms on results pages, providing your users with valuable information.

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

Highlight-search-terms-free-wordpress-plugin

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

Relevanssi plugin screenshot

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. While Search Everything works with 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

WPSOLR screenshot

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, we recommend the WPSOLR plugin. It will enable you to present related content to searchers, and much more. WPSOLR is another freemium plugin, and provides enterprise-level features that only improve with the purchase of its premium versions. While this plugin can work for most sites, you may want to consider the premium version for e-commerce or large sites in particular.

nrelate-related-content-plugin-for-wordpress-wpexplorer

Another simple option for this 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 header or added to a widget area). This is especially helpful if no results are returned and you wish to prompt users to try a different search query. You can 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.

This 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.

Conclusion

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.

Tom Ewer
Post Author: Tom Ewer

Tom Ewer is a professional blogger, longtime WordPress enthusiast and the founder of WordCandy.

Disclosure: This page contains external affiliate links that may result in us receiving a comission if you choose to purchase said product. The opinions on this page are our own. We do not receive payment for positive reviews.
Got something to say? Join the discussion.
  1. The problem is that the search function in WordPress, doesn´t work so god and needs improvement! I usually add the Google custom search widget.
    • AJ Clarke says:
      AJ Clarke
      I agree, Google custom search is way better. That says have a look at our search results page, I've customized it quite a bit to make it more useful ;)
      Admin
  2. arth1992 says:
    hey you have design bug in your site . When browser is minimized the tabs in "About the Author" section get disappeared except the "Bio" tab. (y)
    • AJ Clarke says:
      AJ Clarke
      This isn't a bug, these secondary tabs are hidden via CSS on purpose so the design looks better on mobile devices.
      Admin
  3. Seth James says:
    Great blog, thanks! Question: at the moment entire pages are shown in my search results. Is there a way to just display the first paragraph? Many thanks
    • AJ Clarke says:
      AJ Clarke
      Hi Seth, Yes you can change this easily, but the display of the search page is based on your theme settings so it's an adjustment you'll need to make in your child theme and there is no way for me to tell you how because every theme is coded differently. You might have to hire a freelancer for this tweak ;)
      Admin
  4. Danny Mayer says:
    Any suggested plugins for custom google search for global multisite search?
  5. Stefan Bols says:
    Hey. Great post, which is now bookmarked. The post gives some great insights in which thoughts is important for a developer, who's developing something search related of course. But also how to keep users on you site. All in all, thank you for this great blog post! And btw, nRelate Related Content is unfortunately not available anymore :-( Best regards, Stefan Bols Denmark
    • Kyla
      Oh no - nRelate was a great free plugin :( Thanks for the heads up!
      Admin
  6. Sara Leonard says:
    Search plugin is definitely required for better search features. I have Implemented 'searchIQ' recently on a client's website and it's super cool. The features provides great search experience and analytics data.
  7. How did you get the "Filter Results By" section above the search results on this site?
    • Kyla
      Our website is completely custom, and hand coded by AJ (our founder, dev & WordPress guru) :-) But I do think plugins like FacetWP you can use to easily add more search options/filters to your website.
      Admin

Leave a Reply