How to Add Google Search in a WordPress Site

We all know WordPress is an powerful CMS tool but the built in WordPress search functionality at times is sluggish & doesn’t match the Search keywords that well.You can see this on a large WordPress site with huge number of posts and/or pages.

In addition to that, WordPress search functionality display’s Search results ordered by date and not by its relevance to the keywords.

To overcome this I would suggest you to power the search functionality of your WordPress Blog using custom Google search.By implementing Google Search on your WordPress site users can find better related post’s based on readers query, which helps you in reducing Bounce Rate.Not only that You can configure Google Custom Search Engine to search multiple other websites/domains.

How to Add Google Search in a WordPress Site

In this WordPress tutorial I will show you on how to replace WordPress built in search functionality with Google custom search without using any plugins.

  1. First you need to do “Create a Custom Search Engine for your blog”. Go to http://www.google.com/cse/ –> Add  –> Enter the website(s) name to Search.
  2. That’s it ” You’ve successfully created new Custom search engine.”
  3. Now Click on the Get Code Button.
  4. You will get code some thing like this.Replace WordPress Search with Google Search
  5. Copy the following code, and paste it into a <div> element in your site’s <body> section, where you want both of the search box and the search results to render.
    Note: For the most cross-browser compatibility, it is recommended that your HTML pages use a supported doctype such as <!DOCTYPE html>. CSS hover effects require a supported doctype.

That’s it, WordPress Search Functionality will be replaced by Google Custom Search & hope it will give better search experience to your readers.