You must have seen at times that the search feature on a website is not the default search, In WordPress website we see a search box which is used to search within the website. In this tutorial we will share knowledge on how to create a Google Custom Search in your WordPress Website.
Create your Google Custom Search Engine
- Firstly, go to Google Custom Search Engine and Sign into your Google Account
- Click on New Search Engine and put your WordPress Website’s URL. Note: Your provided URL will also be used as the name of your Google Custom Search Engine.
- Click on the ‘Create’ button to go to next step.
- Click on the Get Code Button (Since we want to add it to your WordPress site). Note: You will get the code for your custom search engine
Adding your Google Custom Search
- Go to Appearance » Editor in your WordPress admin area
- Click on searchform.php file to open it in the editor.
- Paste the custom search engine code in the file. Note: If your theme doesn't have a searchform.php file, then create one using a text editor for example Notepad
- Paste the Google custom search code
- Go to Appearance » Widgets to drag and drop the search widget into your sidebar.
That’s it! You did it, preview your website and see the results.