How to Add Google Search in a WordPress

by | Last updated Dec 23, 2024 | Published on Dec 23, 2024 | WP Tutorial | 0 comments

Do you want to add Google Search system to your WordPress? By default, the search function on WordPress is 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.

how to add google search

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 on how to add a 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 a plugin.

Method 1: Adding Google Search by Plugin

This method I just recommended for WPBeginner

Step 1: 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.

how to add google search

Step 2: 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.

how to add google search

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.

how to add google search

Step 3: Install Plugin

Then, log in to your WordPress and install the plugin WP Google Search. If you do not know how to install the plugin, please refer on tutorial how to install plugin.

Step 4: Complete the Settings

Navigate to Settings » WP Google Search and here you need to configure some settings.

how to add google search

On the Google Search Engine ID section, please put Search Engine ID which is you have already done in step 2. Please refer back and copy & paste on this section.

Your ID looks something like this

123456789009876543210:fghqweb0p-u

how to add google search

On Search Page Target URL it will create automatically your page.

After you finish and satisfy with your settings, click the Save Changes button.

Step 5: Add CSE Widget

Navigate to WordPress menu Appearance » Widgets and put the WP Google Search (WGS) to the primary sidebar.

how to add google search

Now you are ready to use it.

Example of WP Google Search Widget

For now, you have finished install CSE on your WordPress site by using the plugin.

Method 2: Adding Google Search Manually

The second method requires changing 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 a 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.

So, before we start, make sure you have created ID Google search like shown as on Method 1: Step 1: above, and please created child theme for your WordPress site (ignore if you already have it), and please make a backup on your site.

Backup your site is your choice. If you make a backup and something wrong happen, you can restore them. But here I very recommended backup your site.

Step 1: 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 do not have cPanel then you can use FTP.

If you need help with using cPanel and FTP, then please look at our guide on how to use cPanel and how to use FTP.

Step 2: 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.

Step 3: 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 in the picture below.

Copy all the code and paste it on searchform.php which is you just create it on Method 2: Step 2: above.

Step 4: 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 uses Custome Google Search owned by Google.

How to Customize Design Your CSE? (Bonus)

If you wish to custom design to be compatible with your theme, you can do it on CSE dashboard. Follow this step.

Step 1: Login to the CSE dashboard and choose your desire search engine.

Step 2: 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.

Conclusion

In this tutorial, you have learned how to integrate Custom Search Engine by Google into your WordPress site.

If you have any questions, please drop a comment below and sure I will reply it as soon as possible.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Category

E

WP Tutorial

E

WooCommerce

E

Divi Theme Tutorial

E

cPanel Tutorial

E

SEO & Performance

E

Compare & Review

E

Grammarly

E

Blogger Talk

E

View All Categories

Arbor Design

895 South Randall Road, Chicago

Arbor & Landscaping

4999 Old Orchard Center, Chicago

Let's start work together

Pin It on Pinterest