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.


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?

Sharing is Caring
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.