Replace wordpress search with Google Adsense for Search

Well if you notice that my blog’s default search box has been replaced with Google Adsense for Search box. And if you search for anything, results are shown right in my blog and not on Google page. How to do this?

Well so I am writing a guide on how to achieve this. This guide will work for any wordpress template and across almost all wordpress versions.

Steps to add search page in your blog:

  1. Login to your Adsense account and go to ‘My Ads’ and then click on ‘Search’ and then select ‘Custom Search Engines’.
  2. Now click the +New Custom Search button at top. You will see the following screen. (I have expanded all the possible options – click the image to enlarge it) 
  3. Now fill in the options. Since you are creating it for your blog/site, select the option ‘Only sites I select’ against ‘What to search’ option. Select other options as suited for your site.
  4. Don’t forget to add a custom channel for your search box so that you can track its performance later on.
  5. Select proper style for your search box on the page. Also make sure Ad style matches and blends well with your site’s theme because the that style will be used on the ads displayed on the search page.
  6. Now under the Search results option select ‘on my website using an iframe’ checkbox where Display results: is shown. This will ensure that results are displayed on your site only and visitors don’t have to leave your site during the search operation.
  7. Now create a page on your wordpress blog/site named ‘Search’ with the slug ‘search’ and enter that page’s url in the box where it says ‘URL where search results will be displayed’. It is not compulsory to use the page slug/name as what I am using. You can use it whatever you want.
  8. Leave the width of the search results page as 800 as the search results are displayed best in that width. Since my blog’s design didn’t have that much width initially therefore I dropped the sidebar on my search page by using a custom template to display my search page. You can experiment with lower width for the search page and test whether it works for you or not.
  9. After filling through all the options, click the final button ‘Save and get code’. Now you will see 2 codes are generated : Search box code and Search results code. Save both of them somewhere in a text file. Now your job at Adsense site is completed.
  10. Now go back to the page you created on your site in step number 7 and select HTML tab in write page page (if you had created the site/page in WordPress) and enter the both the codes you got in the above step on this page. Yes we will also display the search box along with the search results. This is because if the user does not get the appropriate results he can use the search box to search again. On my site it also serves another purpose that since I have turned sidebar off on my search results page I need to show the search button again.
  11. Now insert the ‘Search box code’ again on the template wherever you want to show the search code or in a Text widget which you can insert into the appropriate place.
  12. So that’s it. Your site/blog is running a google search box and will show you results from Google and even show your ads on the results page. If you have any doubts, ask in comments.

Note: This was an old post dated back in 2007 which I have rehashed and updated to work with the latest Adsense Dashboard design and on popular requests. 

35 Comments


  1. Does this also apply if I use a wordpress template in blogger.com?


  2. I tried to implement the search code in my website http://www.magghu.com but no result is displayed. please help


    1. What error did you get?


  3. Thanks for the tip, but my search still isn’t showing up


  4. This is an old post but something to note is that Google custom search will only return results to what Google has indexed in it’s own index. So if there are no pages of your site indexed in Google you will get no results on your sites /search/ page etc., when using Google custom search. I ran into this problem myself but didn’t know why without a bunch of searching. Just a quick fyi.


  5. Great step by step tutorial. Worked like a charm. Thank you!


  6. Tutorial has been updated. It no longer needs any plugin. :)


  7. Can’t set it right, there’s no plugin that does this work for me?
    (lazy here)


  8. Mighty search plugin is unavailable!


    1. Thanks for the headup. Will rehash this tutorial and repost it with new method. :)


  9. Good article. I tried your stuff, it shows up my page but there is no search content from google. Need Help!!!


  10. Great Article! BTW I tried using your search box on this page and it doesnt find any results for “MightySearch”


  11. Great article and great plugin.

    I am gona install it to my blog.

    Thanks buddy for sharing.

    Sarfraz


  12. I am afraid that my Adsense – which seems to have changed the Search for Adsense page – does not follow the options you have specified after #1 tip. Would you consider writing a new set of instructions for the new Adsense? Thank you!!!


  13. Hey thanks for the tip. Got this post via Google Search. Will implement this tomorrow.

    BTW where your Google AD’s are gone? :O

    – mrintech


  14. Wow, thanks.

    I have been wanting to do this for a while and you tutorial was easy to follow and spot on.

    Many Thanks

    Dan Collins


  15. Never mind, found it.


  16. I am not seeing where you can control the “page slug”?


    1. Check Step no. 4 and 10 to check what you can choose for your page slug.

      In latest wp, page slug can be edited by clicking edit beneath your post title bar in write page.


  17. :D Excellent instructions. Worked perfectly. Thanks!!!


  18. More about adsense. I received an exciting email yesterday from Joel Comm and I couldn’t wait to share it with you. Joel has just released version 4.0 of his famous Adsense Secrets guide. This guide has been selling for $97 for the past few years and has been the #1 top-selling guide on Google Adsense. Well, Joel is releasing it at an attractive $9.95. This is a no brainer investment. To take advantage of this deal, just go to: http://www.imondayblog.com/goto/as4.html


  19. I wonder if modifying the search form Google provided is against AdSense TOS or not, can you give any info about that?

    Baris Unver’s last blog post..Tayyip’in bilgisayarı


  20. input name=”sitesearch” id=”ss0″ type=”radio

    input type=”radio”


  21. I can`t find this code in my template

    to change it to

    I`m using “i3Theme 1.6” theme

    Any tip

    Thanks


  22. very nice. I am going to link to this page from my blog.


  23. Good trick. I will be implementing this soon in my blog. :grin:


  24. Awesome, and I’d do this…if I didn’t get banned from them A LONG TIME AGO. Adbrite is better, anyways. Thanks for keeping us updated!


  25. Check whether you have exluded pages from google index? Check your header.php and robots.txt for this.


  26. Hi
    I’ve managed to include the searchresults in my blog (not perfect yet but I will fix it later) My problem is that when I use the search function for the blog, it doesn’t not search in any of the pages. Maybe because they are in the database? Hope you have a tips for me :smile: Thank you!
    best regards Erik


  27. This is my first post
    just saying HI




  28. Dang.. I was going to blog this too. But it seems you have already blogged it he he :wink:


    1. No problem. BTW you are not on mybloglog.com? I am sure you are missing a lot by not being on mybloglog.com!

Comments are closed.