How to Add Google Search Into WordPress

By: | Updated: March 25, 2021

Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Currently WordPress offers a search function, but it is very limited on it’s power. Future releases may give use more options, or advanced features if you will, but for now we are going to be stuck with this shabby search feature — or are we?

I have good news for anyone wanting to upgrade the search function on WordPress, you can implement Google Search into your WordPress easily, and it’s free! So just buckle up and I will guide you through this, it’s a very simple process, and I will explain the steps in an easy read to manner for you.  We are going to make this Google Search into a Widget, so we can easily drop it into one of our sidebars. How to Add Google Search Into WordPress is easy !!!!!

1. Add Google Search Into WordPress

Jump on over to google cse and click ‘Create a custom search engine’.  (Note: Link opens in new window.)
It will ask you which site to site(s) to search, for this example, we are going to use the common name:

You can also set your language here, and Website name.  I selected English and named it ‘My Website’
Now it will save your information and take you to a Congratulations page, here you will be able to get the code to add to your Widget.  We are not going to grab the code just yet, because there is a list of edits we can do, which you will find these all on the sidebar to the left on Google.
So let’s go ahead and select ‘Edit Search Engine’ on the left sidebar of Google and then select ‘Setup’.  Here you will be able to add a little more info, and gain a little more info on your sidebar.  I recommend filling in the Search Engine Description, as this will help with SEO.

2. Customize Your Look & Feel

On the left sidebar, under ‘Edit Search Engine’ you will find ‘Edit Look and Feel’.  This will give you the option to how your page is setup once someone actually does a search.

You can toy around with these until you find which one better suites your website. On the tab above, there are even more ways to customize your search page, but we are going to go with the default as I will not be using this as this is just a guide.

3. Get Code

Once you have chosen your ‘Look and Feel’, select ‘Save Get Code’ from the bottom of the page.  This will bring up a page with some JavaScript on it.  Be glad that we don’t have to edit this JavaScript, it is ready to use as it.  So let’s select and copy the JavaScript, I recommend saving it to a text document in case you have to use it again.

4. Input Widget

Once you have your code, go ahead and login to your wp-admin.  Bring up your Widgets page, then drag a ‘Text’ widget to your sidebar, here you will be able to input your code.  You can name it ‘Search’ if you would like.  This will allow you to add the search to your sidebar.
Once finished,


5. Editing

In some themes, this can break the design or sidebar appearance.  To do modifications, simply input a div tag around the JavaScript code.  You can then add the DIV to your CSS file, and edit the width and float if you need to.  Editing the options in your CSE Options on Google can also help resolve any problems that you may face with styling.
If you are having any troubles, please let us know, we can come up with solutions to help you and future coders. Let us know how you did your website and if you could Add Google Search Into WordPress without any headaches.


Leave a Comment