How To: Install Google Custom Search on WordPress

Today i am going to share with you how to install Google Custom Search on WordPress in 6 easy steps. Google Custom Search box is widely used in websites to get unique results from a specific niche. You might have seen a new search box on our site lately located in the sidebar at the top. That’s what we call as a Google Custom Search box.


By hosting a Google Custom Search box in your website you have a lot of advantages such as:

  • When people search for topics on your site, the results returned will be from your domain itself.
  • The results page will only show posts Google indexed from your site. In other words, your readers will get a feeling of genuineness.
  • Google Custom Search results are customizable i.e. if you want you can also add other sites posts into your Search engine with the help of Google Marker.
  • You can also display ads on your Results page with Google Adsense to improve your site revenue.
  • The most important point is that you can create your own small Search world which displays only the things which you love.

So now lets get down to create one! To install Google Custom Search on WordPress, just follow the steps listed below.

Step 1: Login to your hosting account. Goto your theme directory and create a new template file. Strip out the <?php get_sidebar(); ?> line and assign the template a name. Save it.

Step 2: Login to WordPress. Goto Pages>Add New. Create a new page and name it Search so that the permalink will point to something like, Assign the page a template, the one we created in Step 1. Go ahead and publish it but don’t write anything in the body. Leave this tab open, we will get back to this part later.

Step 3: Goto Google Custom Search site. Login with your Google account and enter your details as shown in the pic. Give your search engine a name such as “YOUR SITE NAME” search engine. Give a description to your site such as what is it all about. Give English as your Search engine language. Select Only sites i select option. Enter your site url. Select the Standard edition and finally agree to Google’s TOS. Click Next.

Google Custom Search on wordpress setup

Step 4: Your search engine should have been created by now. Click on the Basics tab. Personalize your search engine further by adding keywords. Next goto the Look and Feel tab. Select the Search Element option as the iframe option has now been deprecated. Design how you want your search box to be displayed. I had recommend Full width layout. There are a variety of colour themes, select one according to your taste. Click the Save button.

Google Custom Search on wordpress customization

Step 5: If you have an Adsense account and wish to make money then goto the Make Money tab. Now link your adsense account. Fill your adsense details. A confirmation link will be sent to your Gmail inbox. Accept it. Now goto the Preview tab and see the live demo of your results page. If you type some queries and see how it responds.

Google Custom Search on wordpress preview page

Step 6: Finally goto the Get Code tab. In the Specify search result details box, enter the permalink of the page that we created in Step 2. For Ad placement select the Top and Right option. You will be given a Javascript code. To enable Google custom search on wordpress simply copy that code and paste it in the body of the page that we created in Step 2. Click the Update button. That’s it now your Google Custom Search box and all your queries will now be displayed on this page.

Google Custom Search on wordpress get code

If you want to display a Google Custom Search box on your homepage, just paste the following code in your sidebar or wherever you want it to appear.

<form action=”” id=”cse-search-box”>
<input type=”hidden” name=”cx” value=”partner-pub-****************” />
<input type=”hidden” name=”cof” value=”FORID:10″ />
<input type=”hidden” name=”ie” value=”ISO-8859-1″ />
<input type=”text” name=”q” size=”31″ x-webkit-speech />
<input type=”submit” name=”sa” value=”Search” />

Enter your details accordingly where its marked in red. Any query you make in this search box will automatically open your results page that we created in Step 2 and display your related posts.

If you found this tutorial about installing Google Custom Search on WordPress useful, please comment and let us know. For more such tutorials and Google updates subscribe to our feed below.

Subscribe to our Weekly Newsletter

I take your privacy very seriously


  1. MME Reply

    Wow, amazing post this very informative & useful thanks for sharing.

  2. Praveen Kumar Reply

    Wow, interesting & good post, I really appreciate your content. The article has really peaks my interest. Thanks for sharing.

  3. Raj @ Blogger Tips & Tricks Reply

    add Google custom search in the blog will also help us in making few extra bucks..

    • Gautam Doddamani Reply

      exactly people will also get to know which our posts have been indexed by google by performing a simple google search! :)

  4. kina Reply

    hi gr8 guide but dunno why after when u use serch form reuslt wont display checked ur website and its same

    • Gautam Doddamani Reply

      hi kina…thanks for bringing the problem into light..i will try to fix it soon! :)

    • Gautam Doddamani Reply

      use the iframe option when integrating search results kina…i have fixed it..if you face any other problems on my site…pls bring it to my notice…thanks :)

  5. Ross Reply

    Great idea: want one too – tried to follow along with your instructions – but lost it at:
    “Step 6: Finally goto the Get Code tab. In the Specify search result details box, enter the permalink of the page that we created in Step 2. ”
    What ‘Specify search result details’ box?
    Can’t see same in accompanying image either …

    • Gautam Doddamani Reply

      hi ross refer to this link for the accompanying image…you see there is a box where google requires you to enter you search results url…just enter your search results page url and then you are good to go.

  6. Shiva @ Blogging Tips Reply

    Hey Gautam,
    Nice tutorial, I have been thinking of the inbuilt google search button in my blog with the Google custom search since my inbuilt one does not show proper results. This article surely gonna help

    • Gautam Doddamani Reply

      hi shiva..thanx a lot for ur comment and yes implementing a google custom search box is very helpful as it gives our blog a brand when people notice it and it also serves as a purpose to know which of our articles have been indexed on :)

  7. Caroline | Reply

    Hi! How do I prevent the new search-page to appear in my navigation menu?

Leave a Reply

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

Notify me of followup comments via e-mail.