Search feature on website is the most important and crucial one and no one can search better than Google, even within your website. Google has made available custom Search engine option for all its AdSense accounts freely and it’s great option that every website owner must avail. Even if you don’t place AdSense ads on your website, you can still benefit from this offer. No matter how good you are, you can never search the most relevant search results and rank them properly from your own website than Google and it’s free!
Although I had previously placed Google AdSense custom search engine on countless websites and it’s very easy to setup and you can follow this post to learn how to setup Google custom search engine on your WordPress Blog, I faced weird problem while setting up Google custom search engine recently on an older website where I had already placed this code to show the search results within the website. With updated layout, upon searching, Google never returned any results on the results page though it redirected correctly. It kept showing the same blank page over and over again and I did check that Google had indexed the website I was trying to get results from.
After several hours, I finally managed to pin point the issue and it’s the new AdSense generated “Search box code” for custom search engine that was missing some variable and which caused results to disappear. I went back to older code and used it in the new templates and I was could see the search results back on website.
Following is the code that AdSense generated which did not work:
Just change the Google AdSense panel generated “Search box code” with this one and hopefully will work (make sure you put your partner id and search results page url you have setup):
Hope that helps.