How to Show Tags and Categories in WordPress Search Results

Here at TaxoPress, our plugins allow you to manage Tags, Categories and all your WordPress taxonomy terms. If you use terms correctly, visitors can use Tags and Categories to find content they're interested in. In another post, we explained how to display Categories and Tags on your site.

However, there's a limitation in the WordPress core: Tags and Categories don't appear in search results. This makes it hard to find content tagged with specific terms.

In this tutorial, we'll show you how to understand and solve this problem.


WordPress Search Results for Tags and Categories

By default, the only returns content on your site. It will not search for media files, comments, custom fields, authors, tags, categories, and other items on your site.

Let's see a practical example of what does NOT show in WordPress search results.

In the image below, we have a post with categories including “CMS”, “Websites” and “WordPress.

The WordPress Posts scren
Post By Writer

If you search for any of the categories attached to your post, you won't get any results. In this screenshot below, I searched for “Websites” and there's no result, even though the category is active and attached to a post.

No results for Categories or Tags in WordPress search results
Abc Writer

Solving the Problem With Plugins

One way to include Categories and Tags in search results is to use the WP Extended Search plugin. This is far from the only plugin that can do this. Other plugins that can do this include Relevanssi and Better Search.

  • Install the WP Extended Search plugin.
  • Go to “Extended Search” and then “Search Settings” in your WordPress admin menu.
  • Choose “Categories” and “Tags” in the “Select Taxonomies” box.
  • Click “Save Changes”.
WP Extended Search plugin for Categories or Tags in WordPress search
Search In Author

Now when you search for “Websites”, the WordPress search will show any content that is linked to that category. It will not index the archive page for the category, and it will not show the category if it's not linked to any posts.

Categories or Tags in WordPress search results

That's all you need to do. When you use the WordPress search, it will show any content with the terms you're searching for. There's a slightly different approach available with the Relevanssi plugin. That plugin won't return the term archive pages directly. However, it will provide search results for posts that are attached to the terms you're searching for. This screenshot below is from the “Indexing” tab in Relevanssi. The description for the feature is this:

“If you check a taxonomy here, the terms for that taxonomy are indexed with the posts. If you for example choose “post_tag”, searching for a tag will find all posts that have the tag.”

Relevanssi plugin and term search results

If you're looking to understand more about how taxonomy data is stored in WordPress and how it can be retrieved, this guide to WordPress taxonomy data will help.

Leave a Reply

Your email address will not be published. Required fields are marked *