Whatever type of content you have on your website, you want to make navigation as simple as possible for your users. It’s difficult enough to get people to visit your website in the first place, so making them happy and keeping them coming back for more is the next step, and simple navigation to the content they want goes a long way toward enhancing user experience. You could add a search bar to your WordPress menu, or allow your visitors to filter your content by category or tag, but there’s another way to make it easier for them to find what they’re looking for: Google search. Let’s see how we can do that in this tutorial.
But, since WordPress has its own search engine, do I still need to use Google? I understand your question. Before I get into the nitty gritty of the how-to, I’d like to discuss the why.
What’s the Point of Having Google Search on My WordPress Site?
It’s simple to answer: using Google’s power has advantages, and using WordPress’s default search feature has disadvantages.
The default WordPress themes have a search feature that works, but it’s pretty simple. That’s all it does: it returns results based on keywords. You need to look elsewhere if you want a more flexible search feature.
Using a custom search bar, whether as part of a theme or as a plugin, is always more effective and gives you more choices. Plugins and themes, on the other hand, require keeping up with WordPress updates. For better or worse, Google does not. Additionally, any search that uses your server’s resources (such as a search using a theme’s search function or a search plugin) can trigger slow performance – in other words, if your server is dealing with more traffic than it can handle, you won’t get a great user experience.
Google, on the other hand, is fast, and you can restrict Google’s searches to your own website or websites using the Google search feature. Furthermore, Google searches are free for the end user, as is setting them up on your WordPress website. Finally, the world’s most common search engine helps the users to customise their searches by using Google operators.
Simply put, Google’s search feature is quicker and more flexible than WordPress’s, and it also incorporates the Google brand, advertising to your visitors the brand’s reliability and speed, which have helped to make Google the search engine powerhouse it is today.
Let’s get down to brass tacks now, with that in mind. You can add Google search to your WordPress website in two ways: with a plugin or by editing your theme files. In either case, you’ll need to use Google’s Programmable Search Engine service to create a custom search engine.
How to Make a Google Search Engine That Isn’t Google
The first step is to sign up for Google’s Programmable Search Engine website. This service will enable you to build and customise a custom, Google-powered, automatically updated search engine, which we will demonstrate how to integrate into your website.
Select Get Started once you’ve arrived at the website.
You’ll be guided to a screen where you can set up your new search engine.
The Sites to search fields are the most critical settings. You can use your search engine to look for a single website, multiple websites, individual pages, portions of a website, or entire domains, as we have done.
You must also choose a language (the default is English) and a name for your search engine.
After you’ve completed all of these steps, you’re ready to CREATE your own search engine.
You’ll be taken to a screen with buttons to add it to your site, view it on the web, and Modify your search engine.
The next step is determined by the tool you choose to use to integrate Google search into your website. Keep this tab open in either case. It will come in handy later.
Using a Plugin, Add Google Search to Your WordPress Website
You must first instal the plugin before you can use it to add the custom search you made. WP Google Search will be included. You’ll need to customise it to use your custom search engine after you’ve enabled it. Pick Settings>WP Google Search from your WordPress dashboard to access the plugin configuration page.
In the top area, you’ll need to enter your Google Search Engine ID. Go to your programmable search engine page and press the Control Panel button to find out what it is.
The Google Search engine ID can be found in the Basics tab of the search engine’s control panel. Click the Copy to Clipboard button to copy this ID code.
Going back to your plugin configuration screen, paste the ID in the Google Search Engine ID field and click Save Changes.
You must now connect this custom search engine’s widget to a widget area in order to integrate it into your plugin. To do so, go to your WordPress dashboard and go to Appearance>Widgets
Then, in the left-hand section of the phone, look for the WP Google Search widget. We’ve decided to put our Search in the bottom right corner of our header. It’s worth noting that the availability of widget areas, as well as their behaviour, is determined by the theme you’re using.
You can drag and drop the widget from the left-hand side of the screen to a widget area on the right, or you can do what we did and choose a widget area from the widget’s drop-down menu and press Add Widget.
And your widget will appear in the widget region you added in your theme.
Using Code, Add Google Search to Your WordPress Website
You can also take a different approach by changing your code. On your Programmable Search Engine screen, look for the Get code button and press it.
In order to incorporate your custom search engine into your website, you’ll need to copy this code.
Then paste this code into the searchform.php file of your theme. Navigate to Appearance>Theme Editor to use it.
Replace all of the code in searchform.php with the code you copied from your Programmable Search Engine from the right-hand side menu. Back up your searchform.php file if you want to be extra cautious. In reality, back it up even if you just want to be safe. Click Update File after you’ve replaced your code.
A search widget also needs to be added to your website. Add the Search widget to your favourite widget field by going to Appearance>Widgets. We’ll put it in the bottom right corner of our header.
Your Google-powered search form will then appear in the location you specified.
Your visitors can now search for something and only get results from your website, or whatever corner of the internet you’ve set your search engine to look into.
Setting up Google search on your website is simple and free, as we’ve shown, whether you do it by editing your theme’s code or installing a plugin. You can’t go wrong in either case; just make sure to back up everything if you’re going to update your code. If you’re unhappy with WordPress’s search method, can’t find a plugin that works for you, or simply want to give your users a better way to access your content, Google may be the way to go.