There are dozens of reasons to admire WordPress, but search is not one of them. For all of the great features and functions that WordPress offers, search is massively lacking. Sure, there is the default search bar that allows users to search for content on your website, but this is a long way short of what is being offered by major search engines. Fortunately, it doesn’t have to be this way, as one of the things that WordPress is great for – functionality – means that you can get rid of the default search option and replace with Google Custom Search. Here’s how it’s done.
Signing up for Google Custom Search
On the CSE page, click on the red link for New search engine and enter your website URL in the Sites to search field. Click on Create to proceed.
On the next page, you will receive a message confirming the creation of your new search engine along with options to Add it to your site and View it on the web. Click on the Get code link and copy the code provided.
Adding Google Custom Search to your site
With your new Google custom search engine created, you can now set about adding it to your website. From your WordPress dashboard go to Appearance > Editor and click on searchform.php.
In the open file, paste your Google Custom Search Engine code.
Next, go to Appearance > Widgets and drag the Search widget over to your sidebar (main widget area).
Your website should now be displaying the new Google search bar.
If your WordPress theme has a specific colour scheme, you may want to customize the search bar to match. You can do this by going to the Google Custom Search Engine website and entering the Look and feel section. In the Customize tab, you will be able to edit your search bar, choosing from a range of themes. You can also change the border and background colour, as well as editing the font displayed in the search box.
Google will provide an image of the search box in the top right of the screen so that you can see what changes look like before confirming them. Once you are happy with your selections, simply click on Save (or Save & Get Code if you are editing the search bar before adding it to your site) and the changes will automatically appear on your webpage.