Do you want to add Google Search system to your WordPress? By default, the search function on WordPress very limited and straightforward. For example, if you use the default search WordPress system, it just shows you on search post title and content only. Not more than that. So that why many WordPress users try to use other search systems such as Custom Search Engine (CSE) from Google.
What is Custom Search Engine?
Custom Search Engine also is known as CSE is a custom search on a website that is own by Google. The best thing about CSE is you can integrate it on your website for free.
In this tutorial, I will show you how you can add Google Search to your WordPress site properly.
What the Benefit Custom Search Engine (CSE) by Google?
Before that, let’s look at the benefit of the Custom Search Engine by Google. Here I listed for you.
- Improve your visitor experience to search something on your site
- Fast, lightweight, and reliable
- Your searching more accurate and relevant search
- Do not give impact on your server resource because it will use Google server
- Free forever but you must often follow their T&C
- Users already trust Google brand because this is owned by Google. This looks small but it can give a big impact.
- Link your adsense account and make money
Having said that, here I will provide you a tutorial how to add Custom Search Engine to your WordPress site.
How to Add Google Search in a WordPress
There are two ways you can do it by manual or use plugin.
Adding Google Search by Plugin
This method I just recomended for WPBeginner
Create New CSE
Go to https://www.google.com/cse/ to register your CSE ID first. Then you will be brought to a direct page like below and click Add. If you already added before this, just use it. Do not create new except you want to install on a new site.
Put Your URL
Here, you need to insert your site. If you aware, they already give you a guide on how to add custom URLs whether you want to apply on the whole site, a specific site, or single page.
Here, I will choose the entire site so the domain name should I put there is www.minutesguide.com/*.
Choose your language preference, give the name of your search engine (as a note), and then click on the Create button.
It should bring you to redirect to the ID page. If not, navigate it from the menu Edit Search Engine » Name of Your Search Engine » Setup » Basic and you will look at a page like below.
Save your Search Engine ID because you will use it at the next step.
Complete the Settings
Navigate to Settings » WP Google Search and here you need to configure some settings.
On Google Search Engine ID section, please put Search Engine ID which is you already done on step 2. Please refer back and copy & paste on this section.
Your ID look something like this
On Search Page Target URL it will create automatically your page.
After you finish and statisfy with your settings, click Save Changes button.
Add CSE Widget
Navigate to WordPress menu Appearance » Widgets and put the WP Google Search (WGS) to the primary sidebar.
Now you are ready to use it.
For now, you have finished install CSE on your WordPress site by using plugin.
Adding Google Search Manually
The second method requires to change some files on your theme. But, we do not change the core theme file. We just need to change the child theme file. That is why important you need to create child theme for your WordPress site.
Second, before you change anything, please backup your file first. If something wrong happens or an incident makes your website crash, so you can restore it to fix it again.
After you have created a child theme and backup on your site, then log in to your cPanel or FTP which is stored in your WordPress file. You can choose one of them, but here I using cPanel. If you not have cPanel then you can use FTP.
After login, look at the Files section go to File Manager » public_html » Your Domain File » wp-content » themes » Child Theme Folder and create searchform.php files.
Go to https://cse.google.com/cse/all and start from menu Edit search engine » Your search engine name » Setup » Basics and the Edition section click the Get code button like shown the picture below.
Copy all the code and paste it on searchform.php which is you just create it onabove.
On the WordPress menu, navigate to Appearance » Widgets, and what you need is just put the default Search widget to the primary sidebar.
Now you have done. Your site already use Custome Google Search owned by Google.
How to Customize Design Your CSE? (Bonus)
If you wish to custom design to compatible with your theme, you can do it on CSE dashboard. Follow this step.
CSE dashboard and choose your desire search engine.Login to
Navigate to Look and feel and here you will see 4 tabs. Layout, Themes, Customize, and Thumbnail.
Here, you can customize anything the design you want. It is very basic. So, I no need to explain more here.
In this tutorial you have learned how to integrate Custom Search Engine by Google into your WordPress site.
If you have any question, please drop a comment below and sure I will reply it as soon as possible.
If you like this article, then please FOLLOW our Linkedin, Twitter, YouTube, Pinterest, and Facebook. Do not forget to check our services page to upgrade your WordPress. If you find this post has an issue with copyright, outdated, or in error, please contact us to fix it.