How to Add Google Search in a WordPress Site

Do you want to use Google search on your WordPress site? Although WordPress comes with a built-in search feature, it is not very good. That’s why many site owners add Google site search on their WordPress site. In this article, we will show you how to easily add Google Search in a WordPress site.

Why You Should Use Google Search in WordPress?

The default WordPress search feature is not very useful. It often fails to find the relevant results. This forces site owners to look for alternatives.

There are plenty ofΒ search plugins for WordPressΒ likeΒ SearchWP,Β Swiftype, etc. The problem is that you still have to manage them, and they will have an impact on your server resources.

On the other hand, you can use Google’s reliable and powerful search feature instead. It is free, allows you to limit the search to your sites only, and can be run from your own site.

Other benefits of using Google search are speed, users already trust Google brand, and you will not have to maintain or update it.

Having said that, let’s see how you can easily add Google site search to your WordPress site.

To make it easy, we have created a video tutorial on how to add Google search that you can watch below.

Method 1: Adding Google Search in WordPress with Plugin

This first method is easier and recommended for beginners. It allows you to add Google search to your WordPress site without modifying your theme files.

First thing you need to do is install and activate theΒ WP Google SearchΒ plugin. For more details, see our step by step guide onΒ how to install a WordPress plugin.

Upon activation, you need to visitΒ Settings Β» WP Google SearchΒ to setup the plugin.

The plugin will ask you to provide a Google Search Engine id. Here is how you will get a search engine ID.

VisitΒ Google Custom SearchΒ website and click on New Search Engine link on the left.

Simply provide your WordPress site’s URL in β€˜Sites to Search’ field. Next, you need to choose the language of your website. Lastly, click on the create button to continue.

Google will now create your custom search engine and will show you a success message with links to further actions. You need to click on the control panel button to continue editing your search engine.

This will take you to the control panel for your custom search engine. First, you need to click on the β€˜Search engine ID’ button and copy your search engine ID.

Next, you need to click on the β€˜Look and Feel’ section. Under the layout tab, select results only.

Once you are done, click on the save button at the bottom of the page to store your changes.

Now you can switch back to your WordPress site. Paste the search engine ID you copied earlier in the WP Google Search’s settings page and then click on the save changes button to store plugin settings.

After that you need to visitΒ Appearance Β» WidgetsΒ page. There you will notice WP Google Search widget in the list of available widgets. Drag and drop the widget to a sidebar where you want to display the search form.

Click on the save button to store your widget settings.

You can now visit your website to see the search form in action.

Method 2: Manually Adding Google Search in WordPress

This method requires making changes to your WordPress theme or child theme files. It is not recommended for beginners. Make sure toΒ backup your WordPress siteΒ before making any changes to your theme files.

VisitΒ Google Custom SearchΒ website and click on New Search Engine link on the left.

Simply provide your WordPress site’s URL in β€˜Sites to Search’ field. Next, you need to choose the language of your website. Lastly, click on the create button to continue.

Google will now create your custom search engine and will show you a success message with links to further actions. You need to click on the Get Code button to continue.

On the next screen, you will see some code in a textarea. You need to copy this code.

For this next step, you will need anΒ FTP client. If you need help, then see our guide onΒ how to use FTP to upload WordPress files.

Connect to your website using FTP and then go toΒ /wp-content/themes/your-current-theme/Β folder. Replace your current theme folder with the name of your current theme.

Locate the searchform.php file in your WordPress theme directory. Download this file to your computer and open it in a plain text editor like Notepad.

Delete all contents of the file and paste your Google custom search engine code. Save the file and then upload it to back to your WordPress site using FTP.

After pasting Google custom search code, go to Appearance Β» Widgets to drag and drop the Search widget into your sidebar.

Click on the save button to store your widget settings.

You can now visit your website to see the Google search in action on your WordPress site.

Customizing Google Custom Search Engine Colors and Looks

Go to Google Custom Search website and edit your search engine. This will show settings for your custom search engine. Click on Look and Feel from sidebar.

Google custom search has some pre-made themes available to choose from. You can also click on customize tab and choose your own font, border, and background colors.

Once you are done customizing the look of your search box, simply save your changes. You don’t need to paste the code again, these changes will be automatically applied to your search form.

We hope this article helped you learn how to add Google search in a WordPress site. You may also want to see our list ofΒ 19+ free Google toolsΒ every WordPress blogger should use.

If you liked this article, then please subscribe to ourΒ YouTube ChannelΒ for WordPress video tutorials. You can also find us onΒ TwitterΒ andΒ Facebook.

Leave a Reply

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

error: Content is protected !!

Pin It on Pinterest

Add address