Most of us as webmasters always wonder to improve the User Experience in our WordPress website with improvements in the revenue.

We always prefer to solve User Experience Issues by Offloading the Jquery or shifting to a more lightweight WordPress plugin or theme or Precaching or Implementing Ultra-fast CDN and many more.

In the process of these wordpress optimizations, we often forget the Search Results offered by WordPress.

To solve a Single Query through wordpress, there is a need for 4Mb Ram. So, in this article, we are going to learn “How we can Replace WordPress Search With Custom Search?” to improve the efficiency of our servers.

WordPress Search is a inbuilt search engine for every WordPress website. It improves the UI of your WordPress website by improving the way your visitors interacts with your website while improving the SEO of your websites without any JSON Error.

Effects of WordPress Search on your server:

Every query search on your WordPress website requires approx 4Mb of Ram. So, there is a need for approx 1Gb Ram for every 40 live visitors while a staging version of the WordPress website needs 400 Mb of Ram.

what to do next:

To solve this overeating of the server, either you need to remove the Search Engine of your wordpress website or you can substitute the inbuilt search engine to the third party search engine like Google custom search, Elastic Search or any other search engine.

Let us Replace WordPress Search With Custom Search Engine.

To Replace the Default Search Engine of WordPress with Google Custom search, we need to get access to Programmable Search Engine from Google by paid Means or by free means.

How to apply for a Programmable Search Engine?

If you want to apply to Google Adsense’s programmable search, you just need to follow the following steps. These steps are listed below:

Go to https://cse.google.com/cse/

Go to https://cse.google.com/cse/ and log in with your Google Adsense approved account. Then, click on the Button “New search engine” listed on the top left to create a highly scalable new custom search engine for your WordPress website.

Website Domain Name

Create a custom search engine from the Edit search engine list on the page left menu panel. Click it in the list, it will show its detailed insight. Under this menu, there are four menus named Setup, Look and feel, Search features, Statistics and Logs on the left panel and four tabs Basics, Ads, Admin, Advanced on the right panel.

Click on Look and Feel

Website will create and helps you to customize Layout, Themes, Customize, and Thumbnails.

Click the Layout tab

Click the Web search item, it will let you choose the search engine layout

Select the Layout

If I select the one-page layout. I may need to use only one JavaScript code. Do not forget to click the Save or Save & Get Code button to save your selection.

Click the Search Features

Google customer Search will show five tabs on the page’s right side, these filters are Promotions, Refinements, Autocomplete, Synonyms, Advanced.

Click the Setup menu

Click the setup menu to enable the monetization feature of the Google Custom Search by linking the AdSense.

Copy the Code

Now, you can generate the code and activate it on your website. Thus, you have successfully generated the programmable Serch Engine for your website.

Add Google Programmable Search In WordPress:

If you want to integrate Google Programmable Search into your WordPress website, you can use either WordPress Plugin or by altering the Search Result page located in search.php and searchform.php on your WordPress website.

Let us learn about these methods to replace WordPress search one by one:

Plugin:

There is a lake of wordpress plugins that can help you to replace normal search with google’s custom search. Some of these wordpress plugin’s are listed below:

WP Google Search:

If you would like a Google search feature on your WordPress site, you only need to register to Google Custom Search, get your Google Search Engine ID, and enter it in the plugin settings page.
Then your custom search engine is ready for use, just put the new Google search box widget on the sidebar, and enjoy it!

In this way, the plugin enables you to insert Google search into your website, or a collection of websites easily. You can search both web pages and images.
You can define if you want to search only on your site (or given sites), or the entire web.
It is possible to customize your search features, the look and feel (layout, themes, custom colours and fonts, thumbnails), and much more.
All these settings can be specified on the Google Custom Search Engine admin site: https://www.google.com/cse/
Your changes will appear instantly on your site automatically.

After you registered to Google Custom Search Engine and get your Google Search Engine ID, you need to enter the ID in the plugin settings page: Settings -> WP Google Search
Use WP Google Search widget or

shortcode to place search box on your site.

Search results can be displayed on a normal page or in a popup window. Use Full-Width layout or Overlay (popup) layout on Google Custom Search Admin site to set up it.

After a successful setup, we have to replace the default search with Google’s Custom search.

Now, we have to replace the default Search Engine of wordpress with the custom Search Engine.

To do this successful replacement, we have to install Real-Time Find and Replace.

Replace Search Engine through Real-Time Find and Replace:

Now, you have to column in the wordpress website in the way it is written above.

Thus, you have successfully replaced regular search with the Google customer search engine through the plugin methods.

Add Google Custom Search Programmable:

In this section, we are going to learn how we can Replace WordPress Search with Google’s Custom search.

First, we have to go to the theme editor of our WordPress website under the WordPress website. Now, search the search.php and searchform.php in the theme editor of your wordpress website.

programmable search custom search Engine

In the Search.php section, you have to replace existing codes with the codes you got from the Google CSE. You have to write the PHP in the following way.

<?php 
/* Template Name: Google Custom Search Results */ 
get_header(); ?>
<div id="content">
<div class="post">
<h3>Search Results:</h3>
[ Insert your Google Custom Search Results Code Here ]
</div></div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

If you are a non-technical human, you must have to stay away from this method as this can destroy the whole search function of your wordpress website.

Pros and Cons:

There are too many pros and cons of replacing the Search engine of wordpress. some of them are listed below:

Pros:

  • Reduce Server Usage: Replacement will help to decrease server usage manyfold.
  • Better Search Results: Google Custom Search Engine uses more sofsticated and powerful algorithms to understand the asked by the query.
  • Monetization: Google custom search also helps you to earn more by enabling the ads on the search results by connecting search engine with adsense.

Cons:

It has only cons as it will remove the branding of your website and puts Google’s band on the search results.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *