Home Blogging How to Add Google Custom Search Engine to WordPress Blog

How to Add Google Custom Search Engine to WordPress Blog

SHARE
GOOGLE CUSTOM SEARCH ENGINE

WordPress’s search engine is quite impressive when it comes to manual searching. But sometimes when visitors want to search for relevant topics, articles, words or phrases, it becomes a task. So by using Google custom search engine, your visitors can find anything with ease.

What is Google Custom Search Engine?

Google Search Engine Console, also known as CSE, is used for custom google search. It places the same results from the search engine on your own website or blog. CSE basically gives the power to your visitors behind the search engine to search for topics on your website. Also, it comes with both the free and paid versions. The free version provides you with all the basic features. You can customise the look of the search engine on your website according to the matching theme of your site. They had the paid version until 31st March 2017, but they discontinued it with effect from 1st April 2017.

Why use Google Custom Search (CSE) for WordPress?

Using CSE in your own website reduces the site load time, i.e your site loads faster. This happens because all the work of search is done by the google search engine and not by your own website’s search engine. BY doing so, all the load is being taken over to Google’s server, and not yours. When you set up your account on CSE, the engine will only pull the content of your website that has been indexed by Google.

You can also use it to monetize your blog by integrating it with Adsense for Search. Once you set up your profile with Adsense for Search, videos will be shown on your website. Once the users or visitors click on the ads, you’ll be paid. However, this also means that you will be showing ads of other companies also on your own website.

Read Also:

Methods to integrate Google Custom Search Engine to your WordPress website

You can integrate CSE in two ways either by the help of a plugin or by implementing it manually. We’ll show you both the ways.

1. Integrating Google CSE with the help of WordPress plugin

One of the best ways to integrate CSE to your WordPress site is to do it with the help of plugins. And the best plugin to work with is the WP Google Search.

By installing the plugin, a lot of work gets off your hands. The plugin usually does half of the work of setting up, but there are some things that you will need to do.

  • Setting up your ID in Custom Search Engine at Google.
  • Copying your CSE ID from Google to the WordPress Plugin.
  • Next, you need to create a specific page in WordPress to act as your “Results Page”.
  • Using a widget for search results, which should be used to replace the default search bar for your WordPress site.
  • Aiming the results to say your results page URL.

After activating the plugin, You need to go to Settings-WP Google Search.

Then the plugin will ask you to enter your Google Search Engine Id.

To get your Id follow these steps-

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

Enter your website name on Sites to Search field. Select the language of your website and click Create.

Google will now create your custom search engine and once done, you’ll get a confirmation message. Now you need to click on the Control panel button to continue editing.

Click on the search engine Id icon and copy the code. Next, go to the Look and Feel section and select Results Only under the Layout Tab.

Click on the Save and get code option to paste the ID to your website on WP Google Search’s settings page.

Next, go to Appearance-Widgets to drag and drop the search engine to your desired sidebar. Click on Save changes button to save everything. Now you will see the custom search engine you created on your website.

2. Manually adding Google CSE to your WordPress Website Without Any Plugin

This method requires making changes to your WordPress theme. Also, make sure to back up your files so that you don’t run out of any. This method is not suitable for beginners.

Repeat all the steps mentioned in the 1st method till you receive the confirmation message from Google.

Then select Get Code option.

On the next screen, you will get a code in the text area. Copy the code to your clipboard. After that, connect your website with FTP and then go to /wp-content/themes/your-current-theme/ folder. Now, replace your current theme folder with the name of your currently used theme.

For the next step, you need to find the searchform.php file in your theme directory. Download the file and then open it in a plain text editor like Notepad.

Delete all the contents of the file and paste your Google custom search engine code there. Save the file and then upload it to your WordPress site using FTP.
After pasting your Google custom search code, go to Appearance-Widgets to drag and drop the Search widget into the sidebar.

Click on the Save changes button and you are ready to use your custom search engine.

Read Also: