How to Add Google Custom Search in WordPress

If you’re using WordPress inbuilt search, then you deprive your readers from relevant posts and miss some revenue from Adsense.

How?

Most of the time WordPress default Search shows results ordered by date, not by relevance. That means most recent posts get priority, even if older posts are related with search terms. Moreover Search terms are not highlighted  in the excerpt and there is no spelling correction. And there are many reasons for which WP inbuilt search Sucks!

Okay, To make our search rocks, we will be using Google Custom Search for our blog instead of default Search. There are many benefits of using Custom search like providing results to the user, decrease the bounce rate, increase Adsense revenue etc.

We have two options to show Google custom results. One is Within Blog Page and another one is on Google page. In this post I will discuss about ‘Within Blog Page’ as it keeps visitor on your blog.

So here is the detail tutorial how to add Google Adsense Custom Search to your WordPress blog.

Before we move to the tutorial, here is the Custom Search Box for RoadToBlogging.com. Do search for anything and watch the landing page. Isn’t it GOOD?

Now follow this simple steps to add a Custom search in your blog.

How to Add Google Adsense Custom Search for WordPress

1. Go to your Adsense Account  . Click on “My Ads” Tab. Select ‘Search’ from left and Click On ‘Custom search engines. Then click on “New custom search engine”. (Follow Screenshot)

Creating Google Custom Search

2. Put you search name like “RoadToBlogging”. In ‘What to search’, select “Only sites I select”. Then write the complete URL of your site. You can also add more than one site on the list. (one URL per line)

Create new Google Custom Search Engine

Then select Country or territory, Site Language, Encoding and Transliteration. for this, I went with default setting. If you have good number of contents, then Use popular queries.

3. Custom channels – You can add custom channels to track performance.

    Search Box Style – I recommend you to use the selected one i mean first one.

    Ad style – Use custom setting to make your Ads

4. In “Search results”, select “on my website using an iframe”. Stop there.

5. In another tab, login to your WordPress dashboard. Go to Pages > Add New. It is the page where search results will be shown. So name this page as “Search”. And page URL will be http://mydomain.com/search. For example, my search page is https://roadtoblogging.com/search.

6. Now move to the step 5. In the field of “URL where search results will be displayed”, put the URL of newly added page.

Search Results

7. Click on “Save and get code”. You will get 2 codes. First one is ‘Search box code’ for displaying the search box and second one is ‘Search Results Code’.

Search Box Code

8. Now put the 2nd code on the html editor of the newly created page.

9. Create a text widget for the place where you want to show your box and paste first code there.

That’s it. You are done. I hope you will earn some revenue from Custom search box and will be helpful for your reader to find relevant result.

Do let us know your experience about Google Adsense Custom Search. And do you have any plan to implement this on your site if you are not using custom search?

16 responses to “How to Add Google Custom Search in WordPress”

  1. Gina Davis Avatar

    Hey thanks. I appreciate the simplicity of your tutorial.

    I was wondering, I know you can get penalized for clicking on ads. Can you get penalized for using the Google adsense search on your website? In past to find old blogs and share their links I would just go to my website.

    thx

    1. Istiak Rayhan Avatar
      Istiak Rayhan

      You won’t penalize as you are not clicking your own ads.

  2. Ayan Avatar
    Ayan

    Thanks for the live-saving post but I think the option of “on a Google page in a new window” is better than “on my website using an iframe” under “search results”. I feel it because of the two reasons:
    1. The first one is, you do not need to create a special page for the search results in the former option.
    2. Secondly, it also ensures that the content of the sidebar do not disturb the search results. As in the latter option, the sidebar ads were overlapping the Google custom ads in my website. So, I prefer the former one.

  3. harshi Avatar
    harshi

    what if i want to apply this custom search to my default search of the theme in the header !

    please help!

  4. Wilma Yulia Avatar

    Hi Istiak!
    I’m using responsive theme with small content width (<<800px, google need min 795px), so I made a page (search result page) and upload it to root folder.. :(
    Do you have better idea?
    Thanks for this tutorial. It's easy to understand.

  5. Kiron Avatar
    Kiron

    Brother how to add search box in my blogspot blog?

  6. rahul pahal Avatar
    rahul pahal

    Obviously, who doesn’t want to earn a few more bugs. If one has started earning from adsense, he should also use google custom search for more revenue. And even google custom search is more attractive than the normal wordpress search boxes.

  7. Martin Cid Avatar

    Good article, Istiak. It’s helping me a lot. Thanks

    1. Istiak Rayhan Avatar
      Istiak Rayhan

      Glad I could help.

  8. Muminur Avatar
    Muminur

    You might have missed one thing, make search page attribute >> Page without sidebar. Will help you earn more.

  9. Akash Deep Satpathi Avatar

    Thanks for the tutorial!

    Recently after thinking about adding this I was get confused on how to add it to my site which search within my site.

    Really helpful article, as always!


    Akash.

    1. Istiak Rayhan Avatar
      Istiak Rayhan

      Glad it helped. Stay Connected!

  10. Amrish Avatar
    Amrish

    Thanks for the great tutorial . I was looking for this for a long while . I have seen many popular bloggers are using this like shoutmeloud.

  11. sabrina Avatar
    sabrina

    does it mean who will enter text in search bar, the website owner will earn some $$ ? sorry i m newbie to wp

  12. Suresh Khanal Avatar
    Suresh Khanal

    Nice tutorial with illustrations. Custom search is, in my opinion, a must and you can’t rely on WordPress default search.

    I wonder how you removed the ‘Google Custom Search’ brand on the search form. I guess Google attaches it along with the search form. Did you remove the code?

    1. Istiak Rayhan Avatar
      Istiak Rayhan

      I didn’t do anything. I just put the code provided by Google.

Leave a Reply

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