Home Web WordPress How to Customize Search Page Results

WordPress How to Customize Search Page Results


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.

And this is understandable. After all, individual sites have far fewer pages than the Internet as a whole, so if you don’t have a page devoted to what the searcher was looking for, he or she is going to be presented with “No Results Found.” Take a look at what our own search results pages look like when there aren’t any results:


Unfortunately, when search result pages on WordPress sites are blank, they leave users empty handed without even so much as a suggestion for where to go next. Basically, say hello to an increased bounce rate.

But there is a pretty quick fix to this issue. All you have to do is make sure your search results pages really work for you.

What do I mean by this?

I mean you should take some time to customize the search page results so they perform a set of additional functions. Custom results pages can:

  • Keep visitors on your site for longer
  • Help your visitors find what they’re looking for
  • Offer related information they might not have known they were looking for
  • Show some personality
  • Show you care about the little things, including being helpful

What follows are several features you can use to customize your internal search results pages. While you could always dive into the search.php code — and I’ve outlined a few such cases where that’s necessary below — there are several plugins you can use to implement these changes.

1. Include the Search Term

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 reminds the user of what she searched for and makes it easy for her to tell if she made a spelling mistake.

This is really important if the search results page winds up blank. You always want to direct your visitors back to your content and you can do that by being helpful. To do this manually, go to Appearance > Editor in the Dashboard:


Then click on search.php. Before making any changes, make sure you have a backup for your site and it’s a good idea to just copy the code into a text editor on your computer to make your edits instead of making the changes in WordPress in your browser. Ideally, access your search.php file through FTP.

search results dashboard

Replace the default title in 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(); ?>"

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

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. Suggest Spelling

A common feature that’s used in standard search engine results is suggested spelling. This way, if you make a typo when searching, you’re prompted with the correct spelling (or a guess) to steer your search on the right path. Google’s “Did you mean…?” is highly effective. You can incorporate this into your internal search results as well.

The Relevanssi WordPress plugin offers this feature. It works best with smaller WordPress sites, so keep that in mind before installing. Another option is yolink. It does cost some money but it may be worth the investment if you want to amp up what you search results offer. Yolink works with large scale sites and offers a wider array of options including faster indexing, multisite functionality, the ability to show related posts, and more.

3. 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 pages. 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 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.

4. Add Suggested Pages

A really good way to increase visitor on-site time is to suggest pages or posts for them to view. So, imagine this scenario: a visitor searches for something within your site and comes up empty-handed. If someone doesn’t find what they’re looking for, that’d typically be cause for them to leave your site. However, if you suggest pages for them to go to — even if it’s not related to their search query — you can do a lot toward decreasing your bounce rate.

The Better Search plugin is a simple way to do this. 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.


A plugin like nrelate Related Content is also a good option. This plugin shows related posts at the bottom of single blog posts and pages. However, you can also configure it to display related posts at the bottom of search results:


Users will be presented with thumbnails from posts that may be related to their search query.


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 — because 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.