How to Use Google Custom Search Engine with WordPress Blog

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:

  1. Under Excluded Sites, click on Add Sites.
  2. Enter the url of the feeds: yoursite.com/blog/?feed=rss2*
  3. Select the option: Exclude all pages whose address contains this URL
  4. Save

Search Box

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>