How to Replace the Wordpress Search Box for a Google Custom Search

How to Replace the Wordpress Search Box for a Google Custom Search

While there is indeed an option to earn Adsense revenue when people use the search bar on your WordPress sites most people don't bother with it. But the truth is it really isn't that hard to implement and in this post, I will show you exactly how to do just that...

Why The Google Custom Search is Better Than a Wordpress Seach Box


Apart from the ability to earn a little bit of extra Adsense revenue, there is also another reason. You see, the built-in Wordpress Search box doesn't take all the page content into account, things like sidebar, comments and even social media comment plugins. But the Google Custom Search box does! This means better results for the people using it, more Adsense revenue for you and even more Adsense revenue because the chances are better of them finding the content they want!

New Custom Search Engine

Swapping the Wordpress Search Box for a Google Custom Search


First of all, you need to click on "My Ads", then click on "Search" on the left-hand side, then click on "+New Custom Search Engine" (see image above) and this is what you should be looking at...

Google Custom Search


The first box is called "Name" and its the name of the search/ad block. No-one else but you will see this and its best to choose something easy to find so you can locate for the stats and if you need it again the code. So for this example, I will call mine "My Site Search 1".

Next is the "What to Search" and this is the important one. If you select "The Entire Web" you will enable a basic Google Search box, but will also get paid if someone clicks on any ads while using it. But if you just want people to search your site and stay on it you need to select "Only Sites I Select". Then, in the box below that you nee,d to enter your own URL.

Next up is "Keywords" and this is where you can help people find the types of things your site content deals with. So if you have a fitness site, include a few fitness and exercise keywords. That way the search they do should be even more relevant to them.

Next up is "SafeSearch" and you should only be turning this option off if you run an Adult based website. Otherwise, its best left on.

Then Country which is something that should be obvious, but if you live in a country targeting another one this is where you might need to change it. The same goes for "Site Language". Then the same again for "Encoding". This should most probably be left unless you are targeting a country other than the EU, USA and Canada.

Then you can also click "Popular Queries" if you want to help the searcher a little more. Then by clicking the 2 little "+" icons next to the "Custom Channels" and the "Search Results" box you should be looking at the bottom part of the Google Custom Search page...

"Custom Channels" and the "Search Results" box


If you wish to use this Google Custom Search as an A/B experiment you can enter some a new custom channel here. But I would suggest that you leave this blank unless you know what you are doing.

Then its the "Search Results" options. You can show the results on your site if you don't want the searcher to go anywhere else, or you could open it in a new window to keep the site looking tidy. Personally, I always use "on a Google page in a new window" so it gives the searcher a new window, but it also keeps my site open in their browser.

Then you can also choose to add a clickable logo to your search which is best done if you are using the "On My Website" option from the options above. You can also choose to place the logo above the search box or beside it if I had to choose I would prefer it besides it.

Then click "Save and Get Code" and you are done, and this is what it looks like...


So there you go. All you need to do now is to put the code into the location your own Wordpress Search is. Often this is easer than you might think because you can remove the "search" option from the Widgets and insert a HTML code box and stick it in there. And that is pretty much all there is to making one. If you do have any troubles as always let me know in the comments below and I will help you if I can.

Comments