WP Custom Search messing up Google Adsense on search pages
Hi everyone,
This nice sunny saturday morning I spent indoors trying to figure out why my AdSense widgets were blank on (custom) search result pages. The problem is with the end of the URL. Blah. Blah. Google. Blah Blah... I'll spare you the details. Let's move on.
This is an example of a custom search plugin search url.
http://www.bonbizzle.com/?search-cla...cp_location-2=
The url above does find all the right pages but all the AdSense 'blocks' stay empty.
A small change will make it work again.
http://www.bonbizzle.com/?search-cla...2=&dummy=empty
Now the url is 'closed' with a variable and value. Again I'll spare you the details but this works.
To achieve this I pasted in my header file (which was heavily modified for the custom search)
<input type="hidden" value="empty" name="dummy">
Basically place this after the last search field so that it will append to the end of the URL.
Most of you won't need this small tutorial/mod but I guess some other people are using both Custom Search and AdSense and I though this might help them avoid wasting a perfectly good saturday morning.
Greetings,
Marco
Last edited by pepsi; August 8th, 2010 at 02:40 AM.