How to Add Google Search in a WordPress Site

WordPress has  its own search function which comes in the form of WordPress Search Widget. But if  you are not satisfied with the funtionality of WordPress’s local search function, then here’s an alternative solution. You can use the Custom Google  Search  in your WordPress-based websites provided by Google itself.

Creating a Custom Google  Search Engine For Your WordPress

So lets start to create a custom google  search engine.

Step 1-

Sign in to Custom Search Engine with your google account.


Step 2-

Enter your WordPress site URL in sites to search section. This will automatically used as your search engine’s name in your Custom Google  Search Engine dashboard. Click on Create button to proceed to the next step.

Custom Search - Create CSE


Step 3-

On the next page, you will see a notification that you have successfully created your custom search engine. Here you will find 3 options for your custom google search engine first one is to GET THE CODE , second is PUBLIC URL and third is CONTROL PANEL.

Click on “Get Code” button and on the page you will find the code for your google custom search engine. Copy the code you will need it in the next step.

get the code


Step 4-

Go to Appearance » Editor in your WordPress admin area and open searchform.php file  in the editor. Replace the existing serach form code with custom google search engine code that you copied  in the last step. Don’t worry if you can’t find searchform.php file just create a new one using a text editor like Notepad and upload it to your theme directory using FTP client and paste that code in it.

Step 5-

Go to Appearance » Widgets to drag and drop the search widget into your sidebar.

That’s all. Now you can see your custom google  search engine in your website.




Leave a Comment

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