How to Create and Add Google Custom Search Box to WordPress

It should not be any longer a matter of doubt that Google Custom Search Engine(CSE)  is far better than the default search box in WordPress.  The default search box returns irrelevant results most of the time and nobody likes getting irrelevant results while searching.  It’s real easy to create, add and customize a google search box to a WordPress website but before that, I would like to discuss –

Why you should use google’s custom search engine on your website?

There are several benefits of using google’s custom search engine in WordPress. Here are some –

  • It uses Google Search algorithms which are the best at showing relevant results.
  • Google Custom Search Engine is free to use.
  • A number of themes, layouts, and colors are available to customize the design of the search box.
  • It’s much faster than the default WordPress search.
  • You can configure it to show the results from one or more websites. In this way, it’s helpful in increasing traffic to all your sites.
  • It gives an insight into what your visitors are looking for as google keeps track of the search queries and thus it adds values to analytic data.
  • When someone searches for something using google CSE, your server resources remain free as it is now a burden of google to provide relevant and precise results.

So these were some advantages of google  CSE over the Default WordPress search. Let’s discuss about creating, adding, and customizing the google custom search engine box to a WordPress site-


Creating Google Custom Search Engine for your WordPress site

  • Go to Google Custom Search Engine and sign in using any of your google accounts.
  • Click on New Search Engine and provide all the information as shown in the picture below.

Creating google custom search engine

  • Click on Create button to proceed to the next page. On the next page, you will get a notification that you’ve successfully created your custom search engine.

get code of google search engine

  • Click on the Get Code button and you will get a code on the next screen. Copy the code. The next step is to add this code to your WordPress site.

Adding Google Custom Search Engine to a WordPress site

  • Go to appearance>>Editor in your WordPress dashboard and find the file Searchform.php as shown in the picture below. If it’s not there then create one using notepad and upload it in the theme directory using the FTP client.

adding google custom search engine code to wordpress

 

  • Paste the code(google custom search engine code) into searchform.php and click on the Update button.
  • After saving the searchform.php file, go to Appearance>>Widgets to drag and drop the Search widget into the sidebar, footer, or wherever you want to show the Custom Search Engine on your website.
  • You are done. Now you are ready to customize it according to the color scheme of your website.

Customizing Google Custom Search Engine

You don’t need to do any editing work on your theme files. Go back to Google Custom Search Engine website and all the changes you make there will be applied to the Search Box on your site.

  • Go Google Custom Search Engine website and click on the search engine you created in the first step.
  • Click on Look and Feel and select the theme.

customizing custom search engine

  • There are a lot of other options (like the color of the outer lining and background of the search engine box etc) for customizing and designing the search engine according to the color scheme of your website and all are pretty self-explanatory. You can see the changes happening live in the sidebar.

Once you are done with customizing, all the changes you made will also be applied and visible on your WordPress site and your visitors will never have a bad experience with the searching ever again.

If you are getting any problems integrating the custom search engine with your WordPress site then let us know through comments. Thanks for visiting my blog.

1 Shares

Did You Find This Post Useful?

Subscribe Below And Get Such Posts into Your Inbox

GO

About The Author

Leave a Comment

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

1 Shares
Share via
Copy link
Powered by Social Snap