How to Add Google Search in a WordPress Site (The Easy Way)

Do you want to use Google search on your WordPress site?

By default, WordPress comes with a built-in search feature, but it is not very good. By adding Google Search in its place, you can display more accurate and relevant search results to visitors.

In this article, we will show you how to easily add Google Search to a WordPress site.

Add Google Search in a WordPress Site

Why Should You Use Google Search in WordPress?

The default WordPress search feature is not very useful and often fails to find relevant results to user queries. This forces many site owners to look for alternatives.

You can use a popular WordPress search plugin. However, the problem is that you still have to manage that plugin, and it will have an impact on your server resources.

On the other hand, you can use Google’s reliable and powerful search feature instead. It is free, allows you to limit the search to your sites only, and can be run from your WordPress site.

Plus, the Google search is fast, users already trust the brand, and you will not have to maintain or update it. You can even allow users to search external websites on Google if needed.

Having said that, let’s see how you can easily add a Google site search to your WordPress site.

How to Add Google Search to a WordPress Site

You can easily add Google Search to your WordPress site by visiting the Google Programmable Search Engine website.

From here, click the ‘Get Started’ button.

Click the get started button on the Programmable Search Engine page

This will direct you to the ‘Create a new search engine’ page, where you must add a name for the search form you are about to create.

Next, select the ‘Search specific sites or pages’ option in the ‘What to search?’ section and add your WordPress site’s URL.

Now, the Googe Site Search will only index the content available on your website. However, if you want Google to show search results from other websites as well, then you can choose the ‘Search the entire web’ option.

Add website URL to create Google Site search

Next, scroll down and toggle on the ‘Image Search’ option to allow your Google Search form to index images on your website. We recommend this option if you sell photos online, have a photography website, or run a travel blog.

After that, you can also toggle on the ‘Safe Search’ switch so that users won’t be shown inappropriate results for their queries.

Once you are done, click the ‘Create’ button.

Click create to generate a google search engine ID

Google will now generate your search engine ID code for you.

From here, simply copy the code and paste it into a notepad app or plain text editor.

Copy the Google Search Engine ID from the website

Now, you must visit your WordPress dashboard and edit your theme files to add the search to your site’s <body>. However, this can be risky, and the smallest error can break your website.

That is why we recommend using WPCode instead. It is the best WordPress code snippets plugin on the market that makes it safe and easy to add custom code.

First, you need to install and activate the WPCode plugin. For detailed instructions, see our beginner’s guide on how to install a WordPress plugin.

Note: WPCode has a free plan that you can use for this tutorial. However, upgrading to the pro version will give you access to more features like smart conditional logic, a cloud library of code snippets, and more.

Upon activation, visit the Code Snippets » + Add Snippet page from the WordPress admin sidebar. Here, click the ‘Use Snippet’ button under the ‘Add Your Custom Code (New Snippet)’ option.

Add new snippet

This will take you to the ‘Create Custom Snippet’ page, where you can type any name you like for the snippet. Then, select ‘Universal Snippet’ as the code type from the dropdown menu on the right.

Once you do that, simply paste the Google Search Engine ID into the ‘Code Preview’ box.

Paste the Google Search Engine ID into WPCode preview box

Then, scroll down to the ‘Insertion’ section and select the ‘Auto Insert’ mode. The Google Search form will be automatically added to your site upon activation.

After that, you can expand the ‘Location’ dropdown menu to choose where you want to display your search box.

For example, if you want to display the search form at the top of all your pages and posts, then you can select the ‘Insert Before Post’ option.

Choose location and insertion for the search engine ID

Next, scroll back to the top and toggle the ‘Inactive’ switch to ‘Active’.

Finally, click the ‘Save Snippet’ button to store your settings.

Save Google Search Engine ID snippet

You have successfully added a Google Site search form manually.

You can now visit your WordPress blog to see it in action.

Google Search preview

Alternative: Use SearchWP to Create an Amazing Search Form

If you find it difficult to add Google Site Search to your website or you are looking for an alternative, then you can use SearchWP for internal search.

It is the best WordPress search plugin on the market that automatically replaces the default search form and allows users to find anything they need on your site.

The SearchWP homepage

SearchWP is used by over 30,000 websites and lets you create a custom relevance scale to adjust the search algorithm.

You can also make any part of your site searchable including PDFs, custom post types, media, comments, custom fields, WooCommerce products, and more.

If you have a multilingual site, then you can also create a multilingual search with the plugin.

Configure SearchWP engine settings

However, you must keep in mind that, unlike Google Search, the plugin can only index and show results for content available on your website.

For more details, you can see our tutorial on how to improve WordPress search with SearchWP.

We hope this article helped you learn how to easily add Google Search to a WordPress site. You may also want to see our beginner’s guide on how to get my WordPress site listed on Google and our tips for using Google Search Console to grow website traffic.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Add Google Search in a WordPress Site (The Easy Way) first appeared on WPBeginner.

How to Improve WordPress Search with SearchWP (Quick & Easy)

Do you want to improve your WordPress search with SearchWP?

By improving WordPress search, you can show your users the most relevant results to improve content discoverability and make more sales.

In this article, we’ll show you how to improve your WordPress search with SearchWP easily.

How to improve WordPress search with SearchWP (quick & easy)

What is SearchWP?

SearchWP is the best custom search plugin for WordPress, used by over 30,000 websites. It lets you improve your WordPress site search to deliver more relevant results to your visitors.

SearchWP

This plugin puts you in complete control of your WordPress search algorithm. You can create your own relevance scale and adjust the algorithm without writing any code.

SearchWP also lets you make any part of your site searchable, including PDF documents, custom tables, ACF files, text files, custom fields, WooCommerce products, and more.

SearchWP engines example

You also get access to detailed search metrics to see what your visitors are searching for and the types of content they’re finding.

This gives you actionable insights to improve your existing content and plan new content.

SearchWP metrics example

Plus, SearchWP automatically integrates with all major WordPress plugins like WooCommerce, bbPress, Meta box, Easy Digital Downloads, and more.

Beyond improving your default WordPress search, it has more features like redirection after a search is performed, excluding specific content from search, keyword stemming, support for multiple search engines, and more.

With that said, let’s show you how to set up SearchWP properly to improve your WordPress search.

How to Install and Set Up SearchWP

The first thing you need to do is activate and install the SearchWP plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit the Settings » SearchWP page and then click on the ‘License’ menu option.

Enter SearchWP license key

Then, enter your license key in the ‘License’ box and click the ‘Activate’ button.

You can find this information in your account on the SearchWP website.

Once you’ve done that, you need to click on the ‘Engines’ menu option.

SearchWP engines settings

This brings you to a screen where you can set your search engine settings. Think of it like creating your own Google search algorithm for your website.

With SearchWP, you need to create a site-wide search engine before you can customize your search further.

You can adjust your search engine settings by clicking on the ‘Posts’, ‘Pages’, ‘Media’, or other available drop downs.

Every section has ‘Attribute Relevance’ sliders that change how the search engines value and rank content. For example, if you want to value the post title higher than the content, then you can adjust the slider accordingly.

Adjust SearchWP slider settings

After you’re done customizing your default search engine settings, make sure to click the ‘Save Engines’ button to create your first search engine.

Once the initial index is created, SearchWP will replace the default WordPress search with your new improved search. If your theme already has a search box, then you don’t need to make any changes.

If you don’t already have a search box on your website, then it’s easy to add one. Simply navigate to Appearance » Widgets and click the ‘+’ icon to bring up the widget block menu.

Add new widget block for search

After that, type ’Search’ into the widget search box.

Then, select the ‘Search’ block.

Add new search block

This will insert a search form into your sidebar.

You can customize the title of your search form and add optional placeholder text if you prefer.

Update and save search form widget

Make sure you click the ‘Update’ button to save your changes.

Now when your visitors use your search form, they’ll be using the improved SearchWP search.

SearchWP search widget

There are all kinds of ways you can customize the search experience on your site with SearchWP, so let’s take a look at a few of them below.

How to Make PDF Files Searchable in WordPress

If you upload a lot of PDF content to your website, then you can allow your users to search the text in the PDF files to find what they’re looking for.

SearchWP quickly indexes the PDF content you’ve added to your media library and displays the files in search results.

To make sure your PDFs are searchable, go to SearchWP » Settings to bring you to the engines page.

Then, in the ‘Media’ section, you’ll find a slider called ‘Document Content’. You need to make sure this is enabled.

Media engine slider SearchWP

For some users, this option won’t be enabled yet.

To turn this on, click on the ‘Add/Remove Attributes’ button.

Add new attribute to media search

This brings up a popup where you can manage the attributes for how your media is searched.

Simply check the ‘Document Content’ box and then click ‘Done’.

Select document content search box

Now, you can adjust the slider settings to give weight to your PDF content.

Then, make sure you click the ’Save Engines’ button.

Now, your visitors will be able to search through your PDF content and find relevant results.

PDF search results example

When your visitors click the PDF result it will take them to a page where they can view the entire PDF document.

Add a Search By Category Feature to WordPress

If you have multiple categories of content on your WordPress website, then you might want to let users search for a single category at a time.

You can do this by adding a category select drop down to your search forms.

Category select drop down example

For more details, see our guide on how to search by category in WordPress.

Add a Live Ajax Search Function to WordPress

Another feature you’ve probably seen is live Ajax search, also called instant search. This adds a drop down autocomplete feature that’s common in search engines like Google.

Instant search helps your visitors to more quickly find what they’re looking for, which can keep them on your website longer.

SearchWP makes it easy to add this feature to your website.

Live Ajax search widget example

For more details, see our guide on how to add live Ajax search to your WordPress site.

Add a Smart Product Search to Your Online Store

If you run an online store, then you want to make sure your visitors can find the products they’re looking for.

SearchWP WooCommerce search results

SearchWP makes it easy to improve your WooCommerce product search and make more sales.

You can fully customize your WooCommerce search engine and give weight to the product attributes that matter most.

Add WooCommerce search product attributes

For more details, see our guide on how to make a smart WooCommerce product search.

Create a Custom Post Type Search Form in WordPress

With SearchWP, you can create all kinds of advanced search forms, like a custom post type search form.

To do this, you’ll create a separate search engine that only searches through a single post type. For example, here is a search form that will only search through coupon posts.

Custom post type search form example

For more details, see our guide on how to create advanced search forms for custom post types in WordPress.

SearchWP is a very flexible and valuable WordPress search plugin. You can create completely custom WordPress search engines that deliver more relevant results for your visitors.

We hope this article helped you learn how to improve WordPress search with SearchWP. You may also want to see our picks of the best live chat software for small businesses and our guide on how to get a free business email address.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Improve WordPress Search with SearchWP (Quick & Easy) appeared first on WPBeginner.