How to Add Google Custom Search Plugin in WordPress Site

How to Add Google Custom Search Plugin in WordPress Site: If you own a website grounded over WordPress and willing to award with robust power of Google Custom Search enabling your users to achieve more relevant data from your site. You are at the right place. However, the default search engine equipped with WordPress is not so efficient to drag the content on your website powered with WordPress.

In contrast to Google Search it is not so smart and efficient, so you should opt to incorporated Google Custom Search (CSE) into your WordPress powered site. Thus, it lets your users/visitors to search your site more efficiently.

In bottom line, do you wish to Google employ its power to search content on your WordPress site then nothing would be perfect to integrate the custom Google Search. Moreover, the WordPress already incorporates a good search functionality but found to be very sluggish and almost unable to affirm right kinds of keywords. It seems to be more apparent in the case when your site comprises a large counting of post or pages. However, rather than of displaying search result relevant with keywords it used to display the posts/pages sorted by date.

Moreover, the Custom Google Search is not limited to your website only, but it tends you to configure accordingly and search on distinct domains or websites also. This plugins seems to be very flexible and simple to implement as well as can be configure for both search results and search box. Thus it is a must have plugin for all websites which sits on WordPress in account of its capability of blending the flexibility of their interface and the power of Google’s Search engine. It is also convenient to display in three distinct formats: withing the search widget, under the search box, as a pop-up resizable dialog and can be displayed anywhere in the code.

Implementing Google Custom Search plugins into your WordPress website will not only make you ease in custom search work efficiently but also render it SEO friendly and can drag the insight pages in an great way. So, now let me take you through the entire post How to Add Google Custom Search Plugin in WordPress Site that will tell you how you can actually implement Google Custom Search into your WordPress powered website.

However, before we proceed further, here I would like to present a video for How to Add Google Custom Search Plugin in WordPress Site, so check out that will explain through live on screen navigation.

How to Create a Custom Search Engine

Before you initiate the processes to set-up Google Search engine into your WordPress Site first of all you are supposed to visit Custom Google Search that will take you through Google Search Custom page where you can generate or cultivate search engines for your WordPress website.


After entering the page you will be asked for your search engine name, description as well as the primary language. However, you are required to provide accordingly and also input a list of WordPress websites to search data on.

Further, you need to opt for an edition from an ad supported free version or paid version that will eliminate those ads.


At this step of customization, you can employ layout and themes being offered by Google Custom Search which are supposed to work with your WordPress Install.


Eventually, Google is now ready to grab the code for your custom search engine. However, towards this endeavor Google recommend to employ a supported Doc type like <!DOCTYPE html> into your page as the Custom Google Search employ CSS hover effects. Apart of code it provide some additional options too, that can be implemented towards customization of the custom Google search.


Now click mouse button over Change the look and feel link which in result displays some style and layout options to choose among. You are required to opt Results only layout as you are going to employ this in your own site’s search box. Once you accomplished this, click Save & Code button to finish this part and get the code.


After you get the code, now assign your WordPress site details like HTTP/HTTPS and provide the details of search result. It is recommended to use “q”, which is referred as the default Google search query parameter.

Finally, the code is now available to employ in WordPress install, so for the time being you are supposed to buoy up this in a safe place.

Creating Google Custom Search Result Page

Now, get ready to employ a custom page template for custom search instead of in-built search function in WordPress. While starting the custom page template you are required to assign the name of your custom page so that WordPress can use it. However, we will define the name of our template as googlesearch.php and put over the top on our Google custom page.


Furthermore, you can modify the name of file and template to anything as you wish. Once it set in its place, you can proceed further to create the rest of your page. In the coming section of this tutorial post I have employed twenty eleven theme and page.php as a base to pursue ahead and resembles something like this.

Of course, this provide a platform to work with, but we need to eliminate some thing which are worthless in standard page template in order to add code from Google. For instance, we can remove comments and contents sections as we don’t feel need of this then you can include the search code that will look something like this:

Now, the new file called googlesearch.php can uploaded to our theme folder.

Creating the Search Result Page

The code bulk has been accomplished now and you are supposed to create a new page by wp-admin in WordPress. I have define the name of this page as “Search Result”.


Now, you will found that our page doesn’t comprises any content as Google will provide that, but the main thing you are required to accomplish is to alter the template to your custom page template. Here, you are supposed to opt Google Search template from drop down menu present in the right side. After doing it click Publish.


Next, you are required to modify another fragment of code. You need to change the name field from ‘s’ to ‘q’ in searchform.php and form action to the URL for your new result page like action=“”. After accomplishing this modification you have done it.

Tweaking Custom Search Engine

After completing the procedure properly, now you have achieved custom search engine that show your WordPress’ results on your search result page.


You will observe that after hitting a link through the result page you have on screen, it used to open that in a new window that is not supposed to be ideal, however, if you wish you can also change this. For this, you will have to include an additional fragment to googlesearch.php page:

If we add:

between the following:

so we get this:

Now, your search result will open in the same window which is referred as desired result.


Further, Google offer you some additional steps towards customization including employing your own stylesheet etc.

How to Add Google Custom Search Plugin in WordPress Site

Jennifer Adam

The area of interest of Jennifer Adam is to cater technologically advanced and powerful tool which works remarkably with multiple browsers and devices. Being a talented professional of inkyROBO, she is capable of implementing the innovative ideas and also loves to write inspiration blogs.