SearchWP Blog

WordPress Tutorials, Tips, and Resources to Help Grow Your Business

How To Make Comments Searchable In WordPress - Thumbnail

Did you know that by default, WordPress search looks at the title, excerpt, and content of your posts and pages, but not the comments underneath them? This means valuable discussions and user-generated content in your comments section are often overlooked.

Making comments searchable can enrich the search experience on your site, helping users find relevant conversations and information directly tied to your content.

SearchWP adds your comments to WordPress search without any code. When a visitor’s search matches a comment, SearchWP shows them the post where that conversation happens.

In this article, we’ll show you how to make comments searchable in WordPress so no valuable interaction goes unnoticed.

Key Takeaways:

  • WordPress search doesn’t include comments, missing out on valuable user-generated content.
  • Enabling comment search helps visitors find important discussions.
  • Using SearchWP, you can easily expand your search to include comments without writing any code.

Why Do You Need To Make Comments Searchable In WordPress?

Incorporating comments into your WordPress search can change how visitors engage with your site.

For instance, if you run a product review site, a visitor might be looking for specific user feedback on a product before making a purchase.

By making comments searchable, you provide a more complete search result, potentially speeding up the user’s decision-making process and improving satisfaction.

Searchable comments can also save you time. When visitors can find an answer that’s already in the comments, they’re less likely to ask the same question again in a new comment or in your inbox.

So, let’s learn how to make comments searchable in WordPress without writing a single line of code.

How To Make Comments Searchable In WordPress?

The easiest and most effective way to include comments in your WordPress search is by using SearchWP, the best search plugin for WordPress.

SearchWP - Best WordPress Search Plugin

It fills the gap in WordPress’s default search functionality. Using SearchWP, you can make almost everything on your site searchable, including comments.

It’s packed with features like multiple search engines, customizable search rules, and in-depth search analytics to help visitors find what they’re looking for.

More than 50,000 website owners use SearchWP to stay ahead of the competition and provide exceptional search experiences to their users.

Here are a few key features of SearchWP that will improve your online business:

  • Search Behavior Analysis: Monitor and analyze search trends on your website to get deep insights into user preferences and behaviors.
  • Fuzzy Search: Expand search flexibility by finding similar keywords and providing search results even if users make spelling mistakes.
  • Live Search Results: Improve user experience by instantly displaying search results such as posts, pages, and products as users type, offering quick and dynamic feedback.
  • Prioritize Search Results: Adjust the ranking of search results to promote specific posts or products, improving the visibility of key items quickly.
  • Exclude Results: Configure your search engine to omit specific types of content from search results, including posts, pages, and other content that isn’t relevant for searches.

Now, let’s see how to make comments searchable in WordPress step by step.

Step 1: Setting Up SearchWP On Your Site

Start by getting the SearchWP package that fits your needs by visiting the website and signing up for a new account.

Then, log into your Account page to download the plugin zip file. It’s under the Downloads section.

Download SearchWP plugin from account area

After downloading the plugin, copy the license key, since you’ll need it later for activation.

Next, install and activate SearchWP the way you would any WordPress plugin.

Once activated, you can follow the welcome wizard to complete the setup. Start the process by clicking the Start Onboarding Wizard button.

The SearchWP welcome screen with the Start Onboarding Wizard button

The stage is set to make comments searchable in WordPress. Now, we need to configure the search engine.

Step 2: Set Up the SearchWP Engine to Search Comments

Once activated, SearchWP automatically replaces the default WordPress search. But comments aren’t part of the search engine until you add them, so we need to configure it first.

To do that, visit SearchWP » Algorithm. From here, you’ll be able to customize the Default engine or create as many search engines as needed for different use cases.

For this tutorial, let’s configure the Default search engine to support comments. Go ahead and click the Sources & Settings button.

The Sources & Settings button on the SearchWP Algorithm screen

Now, select Comments in the popup window, along with the other sources you want to search.

When you’re finished, click Done to apply the changes.

Selecting Comments as a source in the SearchWP engine

Note: Comments belong to posts, pages, or custom post types, so make sure the sources they’re attached to are selected too.

If the post type a comment sits on isn’t a source in your engine, that engine won’t return the post when the comment matches a search.

You should now see a separate section for each source. Let’s find Comments in the list and click the Add/Remove Attributes button, so we can choose which parts of each comment to search.

The Add/Remove Attributes button in the Comments source section

Next, select which comment attributes you want SearchWP to search. You can choose from Comment, Author Name, and Author Email.

We recommend leaving Author Email unchecked on a public site, so visitors can’t find posts by typing in a commenter’s email address.

There’s also a Custom Fields dropdown where you can pick any extra details that another plugin saves with each comment. After choosing the attributes you want, click Done to save your settings.

Choosing which comment attributes SearchWP searches

You can decide which comment attribute gets the most priority by setting its relevance.

The left end of the slider represents the minimum weight, and the right end represents the maximum.

Adjusting the relevance weight for comment attributes in SearchWP

Note: Comments are not stand-alone items, so they can’t be shown on their own. Rather, when a comment matches a search term, the post or page it belongs to will be shown in the search results.

Finally, click Save to apply the changes made so far. If SearchWP then tells you the index needs to be rebuilt, click Rebuild Index as well.

Saving the SearchWP engine to make comments searchable in WordPress

Congratulations! You have successfully made comments searchable in WordPress!

Your theme’s existing search box already uses the Default engine, so this step is optional. If you’d like a dedicated search form, SearchWP has a no-code search form builder.

Using this builder, you can create a search form and place it anywhere on your website.

To create a new search form, navigate to SearchWP » Search Forms, then click Add New.

The Add New button on the SearchWP Search Forms screen

Next, give your search form a name and select a Layout Theme.

There are pre-built theme layouts offered by SearchWP. Simply select the one you’d like to use for your site.

Naming a search form and choosing a layout theme in SearchWP

Now, adjust the search form to suit your needs. Make sure you assign the right engine to this form.

Scroll down to Engine and select Default, since that’s the engine we customized. If you created a new engine, choose that one instead.

SearchWP also lets you take control of how search results appear. When you pick SearchWP from the Results Page dropdown, you can customize the search results page completely.

Selecting the Default engine and the SearchWP results page for a search form

Here’s a detailed guide on how to fully customize the search results page.

Finally, click Save to finish creating your first search form.

Saving a new SearchWP search form

You can insert this search form anywhere on your website.

To see your options, click the Embed button next to Save.

The SearchWP embed options for a search form

From the popup, you can add the form to an existing page or a new one, or copy the Gutenberg Block, Shortcode, or PHP Code option.

For more help, follow our tutorial on how to create an advanced WordPress search form.

Now, it’s time to check that your comments show up in search.

Pick a word or phrase that only appears in one of your approved comments, then search for it using your site’s search form.

SearchWP should return the post or page that the comment belongs to, even if that phrase never appears in the post itself.

WordPress search results showing a post found through a matching comment

If a new comment doesn’t show up, check that it’s been approved. Pending comments stay out of search until you approve them.

To approve one, go to Comments in your WordPress dashboard and click Approve under the comment. SearchWP adds it to the index automatically in the background.

Approving a pending comment from the WordPress Comments screen

Frequently Asked Questions

1. Does WordPress search include comments by default?

WordPress’s built-in search looks at the title, excerpt, and content of your posts and pages, not their comments.

The Comments screen in your dashboard has its own Search Comments box, but that’s only for logged-in users who manage your site, not your visitors.

2. Why aren’t my comments showing up in search results?

Comments only show up in search when they’re approved and Comments is added as a source in the engine your search form uses.

At least one comment attribute, like Comment, needs to be checked, and the post the comment belongs to must be published with its post type selected as a source.

If SearchWP tells you the index needs to be rebuilt, click Rebuild Index. Our guide on how to fix WordPress search indexing issues covers a few more things to check.

3. How long does it take for a new comment to become searchable?

A new comment becomes searchable shortly after it’s approved, because SearchWP adds it to the index in the background.

You don’t need to rebuild the index for each new comment. Pending, spam, and trashed comments stay out of search.

4. Will search results show the comment itself?

Search results show the post or page a comment belongs to, not the comment on its own.

That way, visitors land on the full page and can read the conversation in context.

Closing Notes

In this tutorial, you have learned how to make comments searchable in WordPress. Configuring the setup requires no coding skills.

We believe that by making comments searchable in WordPress, you can improve the discoverability of content on your site.

You may also want to see our guides on how to make WordPress blogs searchable and how to track searches on your WordPress site.

Get SearchWP now to introduce advanced search functionality to your website. Every plan comes with a 14-day money-back guarantee.

author avatar
Aazim Akhtar

Create a Better WordPress Search Experience Today

Never lose visitors to unhelpful search results again. SearchWP makes creating your own smart WordPress search fast and easy.

Get SearchWP Now
Multiple Search Engines Icon