I had trouble finding a good source of information on how to set up Google Custom Search Engine to replace the built-in search function of my WordPress blog, so I’ll share some tips I eventually learned.
Custom Search Engine
First, you will need to create a custom search engine that shows results for your blog. Then try out your CSE.
If you see that rss feeds are showing up and want to get rid of them, edit the cse Sites category:
- Under Excluded Sites, click on Add Sites.
- Enter the url of the feeds: yoursite.com/blog/?feed=rss2*
- Select the option: Exclude all pages whose address contains this URL
Now that you have your own search engine for your blog, you’ll want to be able to use the search box to search it. In the CSE’s Control Panel, go to the Code category. Select the style you want. Then copy the code that gets outputted. Open up the blog theme’s sidebar.php file (make a backup copy). Look for the search box code and paste over it with the CSE code. You might need to play around with it to make it look nice for your blog.
Note that using CSE limits searches to what Google has indexed of the blog.