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.  Default search box returns irrelevant results most of the time and nobody likes getting irrelevant results while searching.  Its real easy to create , add and customize google search box to a WordPress website but before that I would like to discuss about –

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

There are several benefits of using google custom search engine into 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.
  • Number of themes , layouts and colors are available to customize the design of search box.
  • Its much faster than the default WordPress search.
  • You can configure it to show the results from your one or more websites. In this way , its helpful in increasing traffic to all your sites.
  • It gives an insight about what your visitors are looking for as google keeps track of the search queries and thus it adds values to analytic data.
  • When someone search something using google CSE , your server resources remain free as it is  now a burden of google to provide the relevant  and precise results.

So these were some advantages of google  CSE over Default WordPress search. Lets 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 account.
  • 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 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 Get Code button and you will get a code on the next screen. Copy the code . Next step is to add this code to you 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 its not there then create one using notepad and upload in theme directory using FTP client.

adding google custom search engine code to wordpress


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

Customizing Google Custom Search Engine

You don’t need to do any editing work in 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 search engine you created in first step.
  • Click on Look and Feel and select the theme.

customizing custom search engine

  • There are a lot of other options (like color of outer lining and background of 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 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 bad experience with the searching ever again.

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


1 Share

Leave a Comment

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

Scroll to Top
1 Share
Share via
Copy link
Powered by Social Snap