In our previous tutorial, we have provided the guide to add Google custom search engine to Genesis WordPress theme. If you are not using Genesis WordPress theme and still looking to add Google custom search engine, here is a simple guide for you.
By following this guide, you will be able to add Google custom search engine (CSE) to any WordPress website without using any plugins at all. This in turn will provide better search functionality for your website visitors.
Tutorial To Add Google Custom Search Engine To WordPress:
1) To get started, log into your WordPress dashboard and create a page with the following permalink structure “yourdomain.com/search“.
2) Now log into your AdSense account and go to “My Ads” page. Now click on “Search -> New Custom Search Engine“.
3) Next, enter a name for your search engine. Once done, select “Only sites I select” in the “What to search” settings and enter your website URL.
4) Once done, scroll down and expand “Search Results“. Now select “on my website using an iframe” in the “Search Results” settings, enter the URL of the page you have created (Step 1) in the box “URL where search results will be displayed” and click on “Save and get code” button.
5) Now copy and paste the “Search results code” in the “Search” page (from Step 1).
6) Next, go to “Appearance -> Widgets“, drag and drop a “Text” widget to your sidebar, copy and paste the “Search Box Code” and save it.
7) If you have done everything properly, you will see the Google custom search engine box as shown in the screenshot below.
Note: You can change the style of this search box by adding custom css in your theme stylesheet.
That’s it. Now you have successfully added Google Custom Search Engine to your WordPress website.
If you encounter any issues while following this tutorial, do let me know via comments.