How to Prevent WordPress Users from Creating New Tags
We had an interesting question from a PublishPress user this week:
I am trying to allow user in one role to choose an existing Tag, but not allow them to create new Tags. This was simple enough to do with Categories, but I cannot figure it out for Tags.
This was a great question that requires some explanation. In this guide, I'll explain how to prevent users from creating new Tags, and why it's much easier to do this for Categories.
Understanding How to Create Tags in WordPress
WordPress does handle Tags and Categories differently. Tags are designed for on-the-fly creation by regular authors. In contrast, Categories are designed to be created by higher-level users.
This image below shows what a user in the Author role will see when they try to add Categories or Tags. In the post sidebar there is a metabox for Categories and also one for Tags.
- The Authors can choose existing Categories, but they do not see the normal “Add New Category” link.
- The Authors can create new Tags.
Who Can Create Tags and Categories?
To be able to create new Categories, you must be in the Editor or Administrator role. This is because these roles have the manage_categories capability.
To be able to create Tags, you can also be in the Contributor and Author roles. This is because these roles have the edit_posts capability.
Fortunately, a workaround is possible with the PublishPress Permissions plugin. The next part of this guide will show you how.
How to Prevent Authors from Creating New Tags
In this guide, I'll use the example of the Authors role, but you could use this same approach to block any user role.
- Install the PublishPress Permissions plugin.
- Go to Permissions > Settings in your WordPress admin menu.
- Click the “Core” tab.
- Scroll down to “Filtered Taxonomies”.
- Make sure the box is checked for “Tags”.
- Click “Save Changes”.
- Go to Permissions > Groups in your WordPress admin menu.
- Click “Edit” for “WP Author”.
- Click the “Set Specific Permissions” tab.
- Post type: Post
- Operation: Assign Term
- Adjustment: Limit to
- Qualification: Tags
- Select Tags: Choose all the tags that Authors can choose.
- Click “Add Selected”.
- Click “Save Permissions”.
Now when an Author creates a post, they will be able to choose existing Tags. They can also attempt to create new tags, such as “Tag F” in the image below.
However, when they save the posts, any new Tags will not be saved:
For larger sites with an extensive and continuously evolving list of tags, the previously mentioned method may not be the optimal choice, as it can lead to fatal memory errors when saving a substantial number of tags. In such cases, you can go to Permissions > Settings > Core and enable this option, which restricts users from creating new tags if they do not possess the edit capability.
Block users from adding one specific Category or Tag
In addition to preventing users from adding ANY new tags or categories, you can automatically create tags for authors.
You can also block them from adding specific Tags and Categories items. This video below explains more:
Other restrictions you can apply to users include allowing them to update but not create content, preventing them from seeing other users' files or updating published posts.
With a little code you can also use author data to automatically create WordPress tags or automatically create WordPress Tags for user roles.
Join PublishPress today
Join PublishPress today and you'll get powerful publishing and permissions plugins to improve your WordPress site.
Hello,
It seems that the plugin does not work properly for me. In the article entry window, the tags that are not part of the “white list” disappear from the box but once the article is validated, these unauthorized tags still appear in the article.
So if you have an idea about what is happening, let me know.
Thank you,
Hi Nicolas. Thanks for using PublishPress. Can I ask you to use our Free or Pro support if you have technical problems? https://publishpress.com/publishpress-support/
We can answer general questions in the comments, but our support team look in those other two places to answer technical questions.
Excellent explanation, I was able to solve my problem of multiple tags created by users from the articles