Google Search is most reliable tool to find the relevant search in your WordPress site. WordPress comes with built-in search feature which fails to provide the relevant search for large site. Most of the webmasters add custom Google search engine (GSE) feature to their WordPress site to help their visitor to find accurate contain. In this guide you will learn how to add Google search in your WordPress site.
Benefits of using Google Search feature in WordPress
There’s no doubt Google is one of the best search engine across the globe and it provides free Google search tool for your WordPress site to find accurate and relevant content.
Another benefit of using Google search feature in your WordPress site is speed. It’s the best search tool for small or large website in term of searching relevant contain quickly.
Time needed: 15 minutes.
How to Add Google Search in WordPress Site
- Add Google Search using Plugin
- Add Google Search Manually
Method 1: Add Google Search using Plugin
Plugins made easy to integrate additional tool or feature to your WordPress site. There is a plugin called WP Google Search which has made easy to find the relevant content in your site.
- 1. Install WP Google Search Plugin
- 2. How to Get Google Search Engine ID
- 3. Add GSE ID and Widget in WordPress
1. Install WP Google Search Plugin
After activation you need to setup WP Google Search settings. You can click on Settings then WP Google Search. You will see the Google Search Engine ID box which you can get from Google website following the steps below.
2. How to Get Google Search Engine ID
You can find the Google Search Engine ID following this Google Custom Search link and sign in using your gmail ID.
Now, Click on new search engine link at the left side of your screen. In the Sites to search box type you WordPress site address (URL) and give the name of the new search engine then click on Create button.
You will see the message that created your custom search engine successfully. You need to setup your custom search going to Control Panel button.
It will take you to the setup page where you simply need to copy the Search engine ID clicking on Copy to clipboard button.
Now, Go to Look and fell link at the left side of the screen where you can choose your preferred search result layout. Choose Results only layout and click on Save button.
3. Add GSE ID and Widget in WordPress
Now, Go back to WordPress dashboard and paste the Custom Google search engine ID in the box that you have copied from Google Search setup page then click on Save Changes button.
You have successfully setup the Custom search. Now, you need to add the search box option to your WordPress site using Widgets. Go to Appearance then click on Widgets.
You will see WP Google Search Widget which you need to drag and drop at the widget section e.g. Primary section at the right side then click on Done link and save it.
You can see the Google Custom search box in your WordPress site. Visit your WordPress site and see the Google custom search box at the sidebar.
Method 2: Add Google Search Manually
Adding Google search engine manually in your WordPress site could be challenging for the beginners. You need to access your core WordPress files and replace with the Google search engine code which can be risky. If you have decided to add Google search engine manually then it is recommend you to backup WordPress site before doing this.
Go to Google Custom Search page and click on New search engine. Type your WordPress website name and provide the name of the search engine then click on Create button.
In the next page you have to click on Get Code button.
You will see the code which need to add into the WordPress current themes file using FTP client such as FileZilla. Copy the code.
Now, you need to connect to the web server using FTP client to add the code into your WordPress site. You may like to see this guide on how to use ftp to upload files and folders for more details.
Once FileZilla connects to your web server. Go to /wp-content/themes/active-theme/ folder. Note: Open your active theme folder e.g. twenty twenty.
Find searchform.php file in the list and download it to your computer.
After downloaded you need to edit the file. Open the file using text editor such as Notepad then delete all the contains from searchfrom.php file and paste the Google Custom search engine code. Save the file and upload it back to the web server in same location.
Now, go to Appearance then Widgets. Drag and drop the search widget to the widget area at the right side.
Load your website, you can see the Google custom search in your website.
Hopefully this step by step guide on how to add Google search in WordPress site is helpful. Here is another guide on 5 Best WordPress backup plugins that you may need for your blog.