The default WordPress search may be fine when you are just starting out, but as your site grows you will start to see some limitations. Notably, as the amount of content on your site increases, you will realize that it doesn’t always show the most relevant results – making your content harder to find for your visitors.
Google is most famous for search, and using Google Search on your site can provide a much better experience for your users. If they can find what they’re looking for, it becomes much easier to keep them on your site.
This article will look at why you should consider switching from the default WordPress search to using Google Search on your site, then step you through how to make the switch.
- 1 Why You Should Switch to Using Google Search for WordPress on Your Site
- 2 How to Set Up Your Google Custom Search Engine
- 3 How to Add Your Google Custom Search Engine to Your WordPress Website Manually
- 4 How to Add Your Google Custom Search Engine With a Plugin
- 5 How to Customize Your Google Custom Search Engine
- 6 Conclusion
Why You Should Switch to Using Google Search for WordPress on Your Site
Though improvements have been made to the default WordPress search in recent years, it still works by querying the WordPress database, looking for keyword matches in posts and pages. The basic search has some limitations that affects usability:
- Results are often chronological (although some attempt has been made to weigh relevance).
- Comments, custom post types, and other data are not included without the use of a specialized plugin, such as SearchWP.
- The search results cannot be refined through advanced parameters.
- The search results display the default WordPress excerpts (often the first paragraph).
Many of the limitations can be addressed with plugins, and in a previous post we looked at the best WordPress search plugins available.
Google, on the other hand, is the standard in internet search. We use the word as a verb (“just google it!”) to show how they have captured the concept of search. So if you or your users have started to become frustrated by the results of the WordPress search on your site, you can take advantage of Google’s search expertise.
Replacing the default WordPress search with Google search can help by:
- Including more relevant search results through the power of Google’s indexing and ranking.
- Including all content on your website within search results.
- Searching across multiple domains to provide results from your other web properties.
As the website owner, Google search also enables you to monetize your search results by integrating AdSense, and driving traffic to your other web properties included in the search.
Even the WordPress.org website uses Google search, so it can definitely handle your website.
Let’s see how easy it is to get started!
How to Set Up Your Google Custom Search Engine
Google knows they have great search, so they provide Google Custom Search to make it easy for websites to add a search box to their site that uses Google’s technology. The basic tool is free, but if you want to go further into customizing the design (like removing ads or the Google branding), or to add more powerful features (like rich snippets and data biasing), you can look at Google Site Search (which starts at $100 per year).
Creating a Custom Search Engine for your website is very simple:
- Log into Google Custom Search Engine.
- Click New Search Engine and enter the details:
- Sites to search: You can enter one or more URLs for the sites or pages you want to search, on your site or any other.
- Language: This is the language of the search engine itself, so it affects buttons and design elements.
- Name: This is auto-generated from the URLs entered above, but you can change it.
- Advanced options: You can additionally restrict the search to only pages that include certain Schema.org types, such as Product or Event.
- Click Create.
Your Custom Search Engine is now ready! The next page will enable you to add it to your website, view it online, or modify it through the control panel. You can add the Custom Search Engine (CSE) to your website in two ways:
- Add Google CSE code to your website manually.
- Use Google CSE ID with a plugin.
We’ll cover both of those options below, before looking at ways you can customize the search engine.
How to Add Your Google Custom Search Engine to Your WordPress Website Manually
You can add the Google CSE to your website manually. This is the fastest way, and may be preferred for those of you who don’t want to add yet another plugin to your site. If all you want to do is completely replace the default WordPress search form with the Google CSE, the manual approach gets that done with no fuss.
When you successfully create your CSE, you are given an option to add it to your site:
Click the Get Code button, and copy the code in the box on the following page:
Once you’ve done that, go to Appearance > Editor in the WordPress admin, then click on searchform.php in the list on the right to open it in the editor:
Once that’s done, paste the Google CSE code into this file. You can replace the contents of the file completely, and once you’re done, click Update File.
This is pretty straightforward, but there are a few things to look out for:
- In general, you should really create a child theme for your theme rather than editing the code of the included files. We’ve covered why you should use a child theme and how to create one before.
- If your theme doesn’t have a searchform.php file, you can create one using a text editor and upload it to your theme directory.
- If you want to include the search form somewhere new in your sidebar, you can go to Appearance > Widgets to drag the search widget into a sidebar:
If you’re not comfortable adding the code yourself, you can choose to use a plugin instead. Let’s see how that works!
How to Add Your Google Custom Search Engine With a Plugin
There are a couple of plugins you can use to add Google’s CSE to your site:
1. WP Google Search (Free)
If you are on a budget and want a free plugin to help you add Google CSE to your site, you can’t go wrong with WP Google Search. This plugin has over 6,000 active installs and a 4.5 star satisfaction rating.
To use this plugin, copy your Google CSE ID by going to the Setup page in the CSE dashboard:
Paste that ID into the plugin’s settings and you’re ready to go!
The plugin has limited settings, but you can customize the search within the CSE dashboard, as we’ll discuss shortly.
2. Custom Google Search ($49 per Month, as Part of a WPMU DEV Subscription)
A paid option for working with the Google CSE is WPMU DEV’s Custom Google Search. As with their other plugins, it is available as part of their monthly membership ($49 per month) which includes all their plugins and themes.
This plugin requires you to copy the Google CSE code (not the ID) into its settings. We showed you earlier how to get that code. Once you have entered the code, you can select and customize:
- How the search results are displayed.
- A color style for the search elements.
- Whether to show the search button.
- Whether a sidebar is displayed on the search page.
- A theme for the search popup.
So without going back to the Google CSE dashboard, you can customize the look and feel of your website search using this plugin.
If you want to do more advanced customization of your CSE, take a look at the next section to see the options that Google provides.
How to Customize Your Google Custom Search Engine
If you want to really get creative with your CSE, Google provides a wide range of options to help you customize.
Customize the Look and Feel
- Layout: You can select from multiple layouts for your search engine, including overlay, compact, and results only. Choose the one that best suits your website.
- Themes: You can choose a design theme for your search engine, such as minimalist.
- Customize: This tab lets you select the font, border, and background for various search engine elements, such as URLs and buttons.
- Thumbnails: You can enable or disable thumbnail images in your search results.
Add Search Features
- Promotions: You can add specific URLs (even external ones) to be promoted whenever users search your site for specified keywords.
- Refinements: You can enable your users to filter the search results using predefined categories or labels.
- Autocomplete: Google can generate autocompletion terms for you to help users search your site more quickly.
- Synonyms: Help your users by adding synonyms to your search engine, so that related terms are searched simultaneously.
A useful feature is the integration with Google Analytics, which will enable you to get detailed statistics and data on how your users are searching your site.
You put a lot of time into creating content on your site, but if it cannot be found by users searching your site, they will likely leave. Using Google Search in your WordPress website can help your users find articles of interest your site more quickly and easily, and help you better utilize your site’s content.
We’ve shown you why you should switch, and also given you step-by-step instructions to switch from the default WordPress search, so there’s nothing stopping you from getting this done today.
Are you using Google Search in your WordPress website? We would love to hear your tips and tricks. Share your experiences and subscribe to the comments section below!
Article thumbnail image by PureSolution / shutterstock.com
Disclosure: If you purchase something after clicking links in the post, we may receive a commission. This helps us keep the free content and great resources flowing. Thank you for the support!
Great stuff Tom. My buddy and fellow Divi enthusiast Phil Simon was just asking me how the search was listing and organizing results and I had no clue other than we figured out it was sorting by date.