Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

How to Set Maximum Number of Tags for WordPress Posts

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

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.

How to Set 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.

Setting a maximum number of tags in WordPress

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.’

Setting a limit on WordPress tags

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 get a warning. They can still go ahead and publish the article, as you can see in the following image.

A maximum tags exceeded warning message in WordPress

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.

Exclude User Roles

At this point, you may want to add more tasks to your checklist. For example, you can set a maximum and minimum number of characters for the post excerpt or check that all images have image alt text.

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.

Saving a pre-publish checklist in WordPress

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.

Tag Limit Preview

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.

Adding custom code to a WordPress website

Here, you will see all the pre-made snippets you can add to your WordPress website. These include a snippet that allows you to completely disable comments, upload file types that WordPress doesn’t usually support, disable attachment pages, and much more.

To create a snippet, just hover over ‘Add Your Custom Code’ and then select ‘Use snippet.’

Adding a custom code snippet in WordPress

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’.

Limiting the number of WordPress post tags using WPCode

After that, you can paste the following code into the code editor:

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.

Limiting the number of tags using WPCode

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 make online money blogging with WordPress 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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

4 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Moinuddin Waheed says

    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.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.