How to Convert WordPress Search as Google Search

Last Updated: August 16, 2019
google search on wordpress

WordPress search is powerful enough to find out the post from your site. But if your WordPress site already indexed by Google search engine, it can bring out more relevant and related search results based on your search keyword. It is totally up to blog owners decision to use Google Search or WordPress Built in search function.

If you think to convert your built in search function to Google’s powerful search function, the please read this article to convert your WordPress search function to Google Search Function.

Converting your WordPress site search to Google search which finds content of your site is easy and simple. After doing this, your WordPress inbuilt search button will launch the Google Custom Search which is more comfortable than the original WordPress search. Following the given simple steps will make your WordPress site search form into the Google Custom Search.

 

google search on wordpress

As the first step, we need to find out the “searchform.php” file from your website files. Normally it will be under the main theme folder. Locate that file and open it with Editor.

google search

 

Before attempting to change any thing, do remember to take the back up of the site and “searchform.php” file. To take backup of the “searchform.php” file, you just need to copy and paste the contents into any notepad file.google search

 

Now we need to open your custom Google search code. If you find any difficulty to find the one, you may copy and paste the below given code to any notepad text file. After that you need to change the Google id in that notepad file. After changing the Google id, you need to save the file.

<form id="searchform" action="http://www.google.com" method="get"><input type="hidden" name="cx" value="partner-pub-2044542687082877:2393269179" /> <input type="hidden" name="ie" value="UTF-8" /> <input id="s" type="text" name="q" placeholder="<?php _e('Search', 'themify'); ?>" />

Themify is the theme that we used in this example. You may see a different term in this place based on your theme.

google search

 

Now we can delete the contents of the “searchform.php” file after taking the proper backup. The main step is to copy the custom Google search file you just prepared is to be copied into the “searchform.php“. After copying it, update the file and the changes will be updated.

google search

You may need to enable the search button from your theme settings to view the affected changes. Once completed successfully, typing any query in the search button will open the Google custom search window and the search result will follow. You can revert the changes at anytime by restoring the contents of the “searchform.php” from the backup file created.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.