RoadToBlogging Logo

How to Add Google Custom Search in WordPress

Istiak Rayhan

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


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 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 For example, my search page is

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?

Was this article helpful?
written by

Istiak Rayhan

Istiak Rayhan is the founder of, a blog that aims to make bloggers’ journey easier. Istiak loves to help newbie bloggers to build a better blog. Here’s more about him.


Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. 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.


  2. 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. 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.

  4. 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.

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

  6. 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!


  7. 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.

  8. 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?

Get our latest posts delivered straight to your Inbox. No spam, ever.