Do you want to know how to search posts by tags in WordPress?
By enabling this feature, you can allow your visitors to find the content they’re looking for much faster.
In this article, we’ll show you how to make posts on your site searchable by tags without writing a single line of code.
Why Make WordPress Consider Post Tags When Performing a Search
By default, WordPress searches only by post title, description, content, and excerpts.
But there are many other attributes you can add to your posts to make it easier to find them using search. Post tags are one of these attributes.
For example, you can mark specific posts with the Tutorial tag to let your visitors find these posts by the “tutorial” search term. It’ll allow them to find the right content much faster.
And this is not the only benefit of making post tags searchable on your site.
It’ll also help you to:
- Improve the user experience of your visitors. The easier it is to find the right content on your site, the better user experience your visitors will have.
- Increase the average session duration. Users who find the right content stay on your site longer, which is one of the strongest signals for Google to rank your site higher.
- Boost your content discoverability. A positive search experience encourages your visitors to explore more of your content.
Now that you’ve learned why it’s useful to enable search by post tags on your WordPress site, let’s see how you can do that.
How to Make Post Tags Searchable on Your Site
The easiest way to enable search by post tags on your site is to use a plugin like SearchWP.
SearchWP is the best WordPress search plugin that comes with a lot of powerful tools and features.
It allows you to get full control over how search works on your WordPress site and customize it to meet your needs.
For example, using this plugin, you can limit search to specific post types, exclude pages from search results, and many more.
Over 30,000 WordPress site owners are already using SearchWP to give their visitors the most relevant search results.
Here are a few more amazing things that you can do with SearchWP:
- Display search results in live mode. Want to immediately deliver search results to your visitors? With SearchWP, you can enable displaying search results in live mode in a few clicks, no coding needed.
- Create custom search forms. Want to create a search form with an individual set of settings? SearchWP allows you to add multiple search engines, fully customize them, and link to specific search forms across your site.
- Prioritize specific pages in search results. You can use SearchWP to put specific pages at the top of search results on your site.
- Enable fuzzy search on your site. Want to give your visitors even more relevant search results? Turn on the SearchWP fuzzy search feature, which makes WordPress search for partial matches.
With that, let’s see how you can easily enable search by posts tags on your site using this plugin.
Step 1: Install and Activate SearchWP
To get started, go and grab your copy of SearchWP from here.
Then, log into your SearchWP account and go over to the Downloads tab.
Once there, press the Download SearchWP button and save the plugin’s ZIP file to your computer.
When you finish downloading, copy your license key on the same tab. You’ll need it further to activate your copy of SearchWP.
The next step is to upload the SearchWP ZIP file to your site.
If you don’t know how to do that, you can see this guide on how to install a WordPress plugin.
After you’ve installed SearchWP on your site, the next step is to activate your license.
To get started, navigate to your WordPress dashboard and click Activate License under SearchWP at the top bar.
Then, paste your license key into the License field and press Activate.
Once you activate your license, the next step is to configure your search engine to make it consider post tags.
Step 2: Make Changes to Your Search Engine
To get started, navigate to the Engines tab.
Here you can manage your search engines created with SearchWP.
You can think of a search engine as a set of rules that WordPress follows when performing a search.
SearchWP allows you to add multiple search engines and link them to individual search forms.
As you can see, right now, there is only an automatically created search engine called Default.
It’s linked to every existing search form on your site. By customizing its rules and settings, you can change how WordPress performs a search across your entire site.
For example, you can add or remove search sources, change attribute relevance weights, and more.
To make WordPress search by post tags, we need to add them to the list of Posts search source attributes.
To get started, click on the Posts search source to expand its settings.
By default, WordPress considers the following post attributes: title, content, slug, and excerpt.
Let’s add post tags to this list. To do that, first press the Add/Remove Attributes button.
Then, click on the Taxonomies field.
After that, you’ll see the taxonomies drop-down menu.
Click on the Tags taxonomy to add it to the list of attributes that WordPress considers when performing a search.
After you’re finished adding taxonomies, press Done.
The final step is to save the changes you’ve made to the Default search engine. To do that, press the Save Engines button at the top right corner.
After that, click Rebuild Index to make WordPress reindex your posts and check if they have any tags.
That’s it. Now your visitors can find posts by their tags.
Let’s try out your new search.
Step 3: Test Your New Search by Tags
To get started, click Visit Site under your site’s name at the top left of the WordPress dashboard.
For the purposes of this tutorial, we’ve added a “How to Install a WordPress Plugin” post that has a Tutorial tag.
Let’s see if we can find it only by the tag.
Even though there is no word “tutorial” in the title, description, or content of the post, we still found it.
To make sure it wasn’t a coincidence, let’s do another experiment.
For example, there are several posts with the Showcase tag on our test site. Let’s try to search for them as well.
As you can see, we successfully found the posts by the search term “showcase”.
It means that our WordPress site now considers post tags when performing a search.
In this tutorial, you learned how to search posts by tags in WordPress. It’ll help you to make it easier for your visitors to find the content they’re looking for and improve their user experience.
If you’re ready to enable search by post tags on your WordPress site, you can grab your copy of SearchWP here.
Want to change the appearance of your search results page? Check out the how to customize your WordPress search results page step-by-step tutorial.
Looking for a way to add a search bar to your page? Follow the how to add a WordPress search bar with shortcode guide.