Do you want to set a maximum number of tags for WordPress posts?
Tags are a great way to organize your content, but a post with lots of tags can look confusing or overwhelming to readers. This can be a problem if you accept guest posts or work with lots of different authors.
In this article, we will show you how to set a maximum number of tags for WordPress posts.
Why Set a Maximum Number of Tags in WordPress?
Tags help to organize your content so visitors can find related posts more easily. However, some authors may add lots of tags in an attempt to improve the site’s SEO.
This can make your content more confusing to readers and stop them from finding related content. A large number of tags may also make your site look messy and unprofessional.
For that reason, we recommend using no more than 10 tags per post.
If you manage a multi-author blog or accept guest posts, then it’s a good idea to limit how many tags authors can add to each post.
With that being said, let’s look at how to set a maximum number of tags on your WordPress blog. Simply use the quick links to jump straight to the method you want to use:
Method 1: Limit How Many Tags Users Can Add to WordPress Posts
If you want to limit the number of tags that users can add to each post, then we recommend using PublishPress Checklists. This plugin allows you to add a pre-publish checklist to the dashboard and create tasks that authors must complete before submitting the post.
This includes setting a limit on the number of categories and tags that authors can add to each page or post.
For this guide, we will be using the free version of PublishPress Checklists since it has all the features we need. However, there’s also a premium version available that offers more features like checklists for WooCommerce products.
The first thing you need to do is install and activate the PublishPress Checklists plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, you will need to select Checklists in your WordPress dashboard and then find the ‘Number of tags’ section.
In the ‘Max’ field, type in the maximum number of tags an author can add to a single post.
You can also optionally type in a minimum number of tags.
With that done, open the dropdown that shows ‘Disabled’ by default and choose either ‘Recommended’ or ‘Required.’
If you choose ‘Required’, then guest bloggers and authors won’t be able to publish a post that has more than the maximum number of tags.
However, if you select ‘Recommended’, then authors will only see a warning. They can still go ahead and publish the article, as you can see in the following image.
The PublishPress Checklists plugin also lets you exclude some user roles from the maximum tag rule. For example, editors might benefit from being able to add as many tags as they want.
To exclude certain users, simply type the user role into the ‘Who can ignore this task?’ box. Then, select the right role from the dropdown menu when it appears.
At this point, you may want to add more tasks to your checklist. For example, you might enforce one category per post in WordPress.
For more on this topic, please see our guide on how to add a blog post checklist to the WordPress editor.
When you are happy with the checklist, just click on ‘Save Changes’ to store your settings.
To see the tag limit in action, simply open any post in the WordPress content editor and then start adding tags.
When you go beyond the limit, you will see a warning message in the checklist. In this way, you can improve the editorial workflow and only publish posts with the correct number of tags.
Method 2: Show a Limited Number of Tags for WordPress Posts
Instead of limiting how many tags authors can add to a post, you can limit the number of tags that you show on your WordPress website. This is a good option if you use tags to organize your content in the WordPress dashboard but don’t necessarily want to show all these tags to your visitors.
To limit the number of tags that appear on your website, you will need to add some custom code to WordPress.
Some guides will tell you to add custom code to a site’s functions.php file. However, this isn’t recommended, as any mistakes in the code can cause common WordPress errors or even break your site completely.
That’s where WPCode comes in.
This free plugin makes it easy to add custom CSS, PHP, HTML, and more to WordPress without putting your site at risk.
To start, you will need to install and activate WPCode. For more information, you can see our step-by-step guide on how to install a WordPress plugin.
After that, go to Code Snippets » Add Snippet in the WordPress dashboard.
Here, you will see all the pre-made snippets you can add to your WordPress website. These include a snippet that allows you to exclude specific categories from your RSS feed, or even disable categories and tags completely.
To create a snippet, just hover over ‘Add Your Custom Code’ and then select ‘Use snippet.’
To start, type in a title for the custom code snippet. This could be anything that helps you identify the code in your WordPress dashboard.
Next, you need to open the ‘Code Type’ dropdown menu and choose ‘PHP’.
After that, you can paste the following code into the code editor:
add_filter('term_links-post_tag','limit_to_five_tags');
function limit_to_five_tags($terms) {
return array_slice($terms,0,5,true);
}
This will display a maximum of 5 tags per post. To show a different number of tags, simply change the number 5 to anything you want.
When you’re ready to make the code live, just scroll to the top of the screen and click on the ‘Inactive’ toggle so it changes to ‘Active’.
Finally, simply click on ‘Save Snippet’ to make the snippet live.
Now, WordPress will limit the number of tags it shows on your website.
We hope this article helped you learn how to set and display a maximum number of tags for WordPress posts. You may also want to learn how to track categories and tag analytics, or see our expert picks for the best SEO WordPress plugins and tools.
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.
kzain
This is a super tip for managing tags! Using PublishPress Checklists to set a limit on tags per post sounds like a great way to encourage authors to be more selective with tagging. This could help improve overall website organization and potentially even search engine optimization (SEO) by focusing on the most relevant keywords.
Jiří Vaněk
I am trying to launch a second website with several other people who will act as contributors and write articles externally. Since I am trying to set some rules before the website goes live, this article is great for adhering to the principle of the maximum number of tags an article can have. I thought of setting a rule of one tag per article. Therefore, I would like to ask if my theory is correct. I am worried about content duplication. Does using only one tag have any significance for improving SEO to prevent duplication, or does it not matter much and I can afford to use more tags, for example, 3-5 as a maximum?
WPBeginner Support
Using only one tag should not give you an SEO advantage over using a few descriptive tags and if you have an SEO plugin that will normally mark your tags properly to prevent it from being flagged as duplicate content.
Admin
Moinuddin Waheed
it is good to have control over number of tags used in each posts.
Setting a maximum limit not only helps in better tags organisation but also restrict to use only the important tags and not just stuffing tags with keywords.
Shaikh Sufiyan
How much tags do better on a post.
Donna Cohen
Please explain how tags help me with SEO.