Coding Agency for Web Development » WordPress Development » Why WordPress Search isn’t amazing and How to Improve it?

Why WordPress Search isn’t amazing and How to Improve it?

READING TIME: MIN

Welcome back to this ongoing series on WordPress Search – In Part 1, we discussed all the ways in which you can add search to your WordPress-based website; here we’ll look at why Search needs to be improved and how you can get down to making your search blazing fast and your website a pleasure to navigate.

1. Why WordPress Search isn’t all that great

As we have already learned in Part 1, the basic search can be added to your WordPress website quite easily and in many ways. However, it wouldn’t be adequate for your search needs unless you’re running a fairly limited website or search isn’t really that important to your visitors. I doubt that, but if your website is ambitious, the better search will be indispensable in your grand scheme for internet domination.

Here’s why. WordPress search does its job well, but it looks in far fewer places than a visitor to your website would expect it to – only page titles, text, image titles, alt text and captions, and file names. That’s it. It won’t include comments, tags, widgets or other custom elements, or even your non-basic content, including WooCommerce products. That’s pretty limited.

In addition, if (and when) your website gets larger and adds more pages and content, not only will WordPress Search turn up fewer results, it will take far longer to serve them up too! To put it bluntly, WordPress Search just wasn’t built to conduct deep or fast searches. It’s basic and your website is not going to stay basic very long.

  Rank your WordPress website higher with these SEO tips

So we need something that can step in and retrieve those quick, in-depth, relevant results for your patrons, and make them keep coming back to you for that sweet search experience. Let’s see how.

2. Making WordPress Internal Search a Whole Lot Better

A Dedicated Search Page instead of a Search Bar

People on the internet are no strangers to using search, but a separate search page will make it convenient for them. For this, you’ll have to access your website backend – FTP or a file explorer will do. Open the WordPress database, and browse to /wp-content/themes/[your theme]/page.php

This file describes the basic web page structure within your theme called… well, ‘your theme’. Please remember to do nothing with the similarly-named file ‘search.php’, which is NOT the advanced search page; it defines the structure of the search results page.

Now, create a copy of page.php, rename it to searchpage.php, and open the new file in edit mode.

A majority of the code in this file is applicable to a general blog entry or web page, and we can get rid of it. In doing so, we can trim it down to the essentials of what’s needed on the search page. For example:

<?php /* Template Name: Search Page */ ?>
<?php get_header(); ?> 
<div class="wrap">
<div id="primary" class=”content-area”>
<main id="main" class+”site-main” role="main">
<h1>My Blog Search</h1> 
<p>Find here all that ye seek within my blog!</p>
<p>With this search form, commence your journey through this blog.</p>
<?php get_search_form(); ?> 
</main><!-- #main --> 
</div><!-- #primary --> 
</div><!-- .wrap --> 
<?php get_footer(); ?>

Refer to the WordPress Codex to find out the dos and don’ts of search page creation. On a basic level though, to get the results from code such as the above, you just need to change the content lying between

<main id="main" class=”site-main” role="main">

and

<?php get_search_form(); ?>

Proceed to save the template searchpage.php and return to WordPress. Next, create a webpage named ‘Search’, give it a title and navigate to ‘Page Attributes’ in the sidebar, where you will now find (and select) the template ‘My Blog Search’ that you have created. Once the page is published, you can see it live at the URL – which should usually be yourwebsitedomain.com/search/

  How to Use Google Web Stories for Your WordPress Website?

Use the WordPress Extended Search plugin to enhance WordPress Search

If you only intend to let your search cover more ground in your website and retrieve results from more content, employ the simple and easily-set-up WordPress Extended Search plugin. This plugin helps your visitors search through media, tags, categories, excerpts and even metadata, in addition to the kinds of content that native search can handle.

In Part 3, we’ll elaborate on more ways that WordPress Search can be improved.

Tags:

Vipe Team

Author Vipe Team

Our tireless team who creates high-quality WordPress-related content for you 24/7/365.