The search function in WordPress works well if visitors have an idea of the content you provide. However, it lacks that special something when people are looking for relevant content to a word or phrase. Luckily, you don’t have to stick with the default search field that comes with WordPress. Using Google Custom Search Engine, you may provide an easier method for people to find your material while making the experience more professional.
What Is Google Custom Search?
Google Custom Search Engine, also known as CSE, places actual search results from the engine onto your website. When you add Google search to WordPress, essentially you’re giving visitors the power behind the popular engine to find your content.
Once you register a free account with Google, you can modify the results page in a myriad of ways. As a result, you deliver a powerful method of searching your site while delivering a custom experience for the site user.
Today I am going to show you how to implement Google Custom Search on your WordPress website using two different methods. We are going to go over the plugin method, as well as the method for using your own code you get from Google.
First, let’s take a look at the plugin in question and see all that it has to offer.
WP Google Search
The WP Google Search plugin allows you to easily incorporate a Google Custom Search into your WordPress website. All you have to do is register with Google Custom Search, get your Google Search Engine ID, and enter it in the plugin settings page.
This is the easiest way to implement a WordPress Google Search on the website. It takes a lot of the manual work out of setting up the experience for your users and is easy to install and activate.
WP Google Search allows you to easily insert Google search into your website, or a collection of websites easily. You can search both web pages and images. The results are pulled from the Google main search engine and displayed on a page of your choice on your WordPress website.
Once installed, you will also be able to fully customize the search to make it match your style and colors. Search features, the look and feel (layout, themes, custom colors and fonts, thumbnails), and much more are all also customizable right from the Google Custom Search Engine admin site. Changes made there will update automatically on your website.
How to Add Google Custom Search to WordPress
Method 1: Using a Plugin
Step 1: Install and Activate the Plugin
In order to get a Google Custom Search field on your website, and make it searchable on Google, you first need to install and activate the plugin. You can do this by jumping over to the Plugins page in the WordPress admin dashboard.
Simply use the search field provided and search the plugin by name. When it pops up, install and activate it from there.
Step 2: Access Settings Page
Now that the plugin is installed and activated, you want to access the settings page to set it up and get it running. To do this, click on Settings > WP Google Search. You see that this is now an available option after you activated the plugin.
Step 3: Get a Google Search Engine ID
Once on the settings page, you will have some options to fill out. However, the first thing you need to do is get a Google Search Engine ID. You can see at the very top of the settings page there is a box.
Use the link provided and go get your ID from there. The process is simple and is also explained below in the “Method 2” section if you need it.
When you have the ID you need, copy it and come back here and paste it in the Google Search Engine ID field above.
Step 4: Finish Configuration
Now that you have your ID in place, you can go ahead and finish configuring the settings page. There are some options you can choose from. One of the more important ones to pay attention to is the “Search Page Target URL” field.
This is the page you have created for search results. When someone uses Google Custom Search on your website, they will be bounced to another page within your site to get results. So set the page you have created for that here.
Click on the “Save Changes” button when you are finished to apply all the settings you chose. That’s it! You can now either use the custom shortcode [wp_google_searchbox] to display to search box anywhere on your site you want, or you can use the WP Google Search (WPS) widget in the widget section of your website and add it to any website widget area you want.
Method 2: Use Your Own Custom Code Directly From Google
You don’t have to utilize a plugin in order to use Google Custom Search Engine. In fact, Google will give you the code you need. This means you can implement this service with a simple copy and paste.
Step 1: Create a New Search Engine at Google CSE
Go to the Google CSE website and create a new search engine. If you are not signed in to your Google account, go ahead and do that. If you don’t have an account, then you need to create one and then go to the link above.
Once inside your account, click on the “Add” button to add a new search engine.
From here go ahead and enter the names of the sites you want to use for search (your website).
Then give your new Google Custom Search engine a name and click on the “Create” button.
Step 2: Get Code
After you click on the “Create” button you will be sent to a new page like the one below. It will let you know the new search engine has been created.
Go ahead and click on the “Get Code” button so that we can copy the code we need for your website.
The following will appear once you do.
Copy this code so that you can place it on your website where you want.
Step 3: Place Code on Website
Now, to finish up, take the code you copied and head back to your WordPress website. You can paste this code wherever you want the Google Custom Search engine box to appear. Yes, a page, a post, or a widget area. Pasting the code will display it properly.
Here is an example that I did pasting the code into a page.
If you want to customize the look and feel of your Google Search engine, then go back one page and click on the “Control Panel” button.
When you do, a ton of different control options will display. You can set these however you want and customize the look and feel of your new Google Custom Search box. You will also see the changes happen in real-time on the right.
Whatever changes you make and save are automatically added to the search bar on the website. There is no need to copy and paste the code again.
Why Use Google Custom Search in WordPress?
Adding Google search to WordPress reduces the load on your site. This is because all of the database queries and interactions happen on Google’s server, not your own. In some instances, the results are more accurate as custom post types and custom fields are ignored when searching for relevant content. It may be important to note that when you set up an account at Google, the system will only pull up your webpages that have been indexed by the search engine.
You can also monetize the experience by activating Adsense for Search. You’ll earn a few cents every time someone clicks on a related ad displayed by Google. However, this means you’ll also show ads for other companies on your website.
Google Custom Search in WordPress will deliver the power of the most popular search engine in the world to the hands of your visitors. With the incredible level of customization, you can deliver a unique experience to those who use the system. Take your site further by offering Google Search in a site for WordPress that is both engaging and highly accurate.
What kind of search abilities do you find useful in WordPress? How often do your visitors actually search for something related to your content from your site?