How to Restrict WordPress Categories to Roles

If you’re running a website that allows multiple users to upload and edit posts, it might become a mess if you fail to manage uploaded posts successfully. Normally, your users will add their posts to the wrong categories. For example, a post whose content is related to “Books” turns out to lie under the “Decor” category.

This kind of issue not only confuses your readers but also affects your site SEO. Especially when you’re trying to sell something, it’s difficult for customers to find their desired items.

In such instances, the best practice is to restrict categories that your users can upload posts to. You should display categories that are most coherent to each user only. This will help them choose the correct one to add posts to easily. Of course, you won’t have to spend much time re-checking and arranging everything later on.

At this point, you might wonder how we can do that?

Don’t worry, now you have our article at hand. We’ll show you 2 ways to restrict your WordPress categories to certain user roles, including using codes and plugins.

Let’s move on!

Which Are Roles in A WordPress Site?

WordPress provides you with 5 default user roles including admins, editors, authors, contributors, and subscribers. Each role comes with a set of permissions and capabilities of what action they can take on your site.

  1. Administrator
  2. This is the most powerful role among 5 default ones, which have full control over the website. Administrators or admins can add new posts, edit any posts or even delete them.

    In addition, they can add, manage or delete plugins and them on the site. More importantly, they have the right to add, edit or even delete any user as well.

  3. Editor
  4. If you’re an editor, you can manage everything related to content on your WordPress site. It’s possible for you to add new, edit, publish or delete all posts, including posts added by others.

    An editor can moderate, edit, and delete comments of all posts as well.

    Still, they won’t be able to change your site settings, install plugins and themes, or add new users.

  5. Author
  6. While editors can manage all posts on your website, authors can only add, edit, publish and delete their own posts.

    Authors are not permitted to create new categories. When writing a new post, they must choose an existing category to apply to their content.

    This user role can decide to moderate, accept, delete, or send comments on their posts to the spam box. Comments on others’ posts are visible to them without any editing action available.

  7. Contributor
  8. Contributors can add new posts and edit their own posts. Unlike authors, they don’t have permission to publish them. Instead, they can just submit these posts for review.

    When writing posts they cannot create new categories and have to choose from existing categories.

  9. Subscriber
  10. WordPress allows subscribers to log into your site and update their user profiles. They can change their passwords if necessary too.

    However, these users are restricted from writing posts, viewing comments, or doing anything else inside your WordPress admin area except making changes in their profile.

    This user role is particularly useful if you require users to log in before they can read a post or leave a comment.

Apart from these built-in user roles, you can create custom roles by user roles plugins such as the User Role Editor plugin, Members plugin, etc. Thanks to these tools, roles like Customers, SEO Managers, Translator, or even Event Contributor can be added easily without any hassle.

How to Restrict Access to WordPress Categories by User Roles

We’ve just walked you through 5 default user roles in a WordPress site. Now, let’s move to the next section about how to restrict these roles’ access to your WordPress categories.

There are 2 different paths you can take to limit access to categories: adding code and making use of plugins.

Now, let’s jump in!

Restrict WordPress Categories to Roles with Codes

WordPress enables you to hide specific categories from specific user roles in the Add New Post page with the below custom code.

add_filter('list_terms_exclusions', 'yoursite_list_terms_exclusions', 10, 2); function yoursite_list_terms_exclusions( $exclusions, $args ) { global $pagenow; if (in_array($pagenow,array('post.php','post-new.php')) && !current_user_can('see_special_cats')) { $exclusions = " {$exclusions} AND t.slug NOT IN ('slug-one','slug-two')"; } return $exclusions;

As a result, users of a certain role don’t have the authority to see the hidden categories, and of course, cannot add new posts under these categories.

You can replace see_special_cats in the custom code above with the specific roles that you intend to grant access to your categories.

That’s it! Let’s try out and see how the custom code works out on your site!

Restrict WordPress Categories to Roles with Plugins

In case you find using codes is somehow complicated, you can always search for the help of available plugins in the WordPress repository.
In this article, we’ll introduce a free plugin that proves helpful to restrict your WordPress categories to specific user roles called Restrict Categories plugin.

This plugin gives you the full ability to customize your users based on your website’s categories.
Let’s see it in action!

  • Step 1: Install and activate the Restrict Categories plugin.
  • Step 2: Navigate to Settings > Restrict Categories in your admin dashboard.

A new screen displays.

  • Step 3: Select the roles or users you’d like to restrict categories for.
  • Step 4: Save change

For example, if you only intend to allow authors to post in the “Book” category, you should check the “Book” category box and save your changes.

As a result, when these users go to add new posts in your website, they will only have the option to post in that category.

It’s a great simple plugin you can use to differentiate user roles’ access on your website based on your categories, isn’t it?

Restrict Your WordPress Categories to Roles Now!

Now you know how to make certain categories visible to specific user roles with our article.

Manage your WordPress categories is a cakewalk now just with a few simple steps. You can choose to handle it with some custom codes or a free plugin.

Don’t let your website become a mess before taking action. Manage your site in a smart way now!