How to Create Custom WordPress User Roles

We have previously covered how the default user roles work in WordPress. They are designed to fit the needs of most websites, and for the most part they fulfill these requirements.

However, there are some scenarios where you may desire to modify the capabilities that each role can perform or even add new roles with custom capabilities as you see fit. This can be achieved using the Capability Manager Enhanced Plugin.

Installation

You can install Capability Manager Enhanced straight from your WordPress dashboard by navigating to “Plugins -> Add New” and entering “Capability Manager Enhanced” as your search query.

wordpress-custom-user-roles-1

Alternatively, you can download the zip file from the WordPress repository and upload it to the appropriate folder on your website using FTP.

Once you have installed and activated the plugin, navigate to “Users -> Capabilities” to load the plugin settings.

Overview

The Capabilities page is quite straightforward to use. On the right hand side you will see a handful of options. You can select the role you want to edit, add a new role or capability or copy an existing role into a new one.

wordpress-custom-user-roles-settings-7

The main part of the page shows all the capabilities that you can toggle on or off for each user role. For example, users with the Administrator role can do just about anything on the website, so you will see that all the boxes have been checked for that role.

wordpress-custom-user-roles-settings-2

Turning a capability on or off for a specific role is as simple as checking or unchecking the field associated with that capability and clicking “Save Changes” at the bottom of the page.

You can also delete a role by clicking “Delete Role” at the bottom of the page.

wordpress-custom-user-roles-settings-6

In addition, there is a section named “Additional Capabilities” near the bottom of the page. You will find additional functions that are not part of the WordPress core but have been defined through your plugins and themes.

wordpress-custom-user-roles-settings-5

The exact contents of this section will vary depending on the type of plugins you have installed on your website.

Let’s go over a few scenarios to give you some practical examples of how this plugin works.

One of the limitations of the Contributor role is that it does not allow users with the role to upload images or other media files to their posts without the intervention of the admin or editor.

In most cases, it can be tedious to have an admin or editor check a post every time an image is required, so it is a good idea to enhance the contributor role by turning on this capability.

1. Select “Contributor” in the side bar and click “Load.”

2. Navigate to the “Other WordPress Core Capabilities” section.

3. Tick the box for “upload files.”

4. If you want to change anything else, just tick or untick the option.

5. Scroll to the bottom and click “Save Changes.”

wordpress-custom-user-roles-settings-4

A specific flaw with the default Author role is that it allows users with this role to delete their published posts. This is far from ideal and should not be the case, but we can remedy this by disabling this capability for this role.

1. Select “Author” in the side bar and click “Load.”

2. Navigate to the “Deletion Capabilities” section.

3. Uncheck the fields under “Delete Published.”

4. Make any other change you feel is necessary.

5. Scroll to the bottom and click “Save Changes.”

wordpress-custom-user-roles-settings-9

If you have a specific need and do not want to modify the default roles, you can create new roles and specify the exact capabilities for each role before assigning them to your users.

For example, you can create a role called “Comment Moderator” and set the only capability of that user role to “read” and “moderate comments”. This is useful for websites that need a specific set of users to moderate comments on the website and do nothing else.

1. Enter the name of the role in the sidebar and click “Create.”

2. By default, no capabilities will be selected. For a comment moderator role, select “read” and “moderate comments” under “Other WordPress Core Capabilities.”

3. Scroll to the bottom and click “Save Changes.”

wordpress-custom-user-roles-settings-11

That’s it, you now have a fully functioning custom user role that you can assign to anyone whose sole responsibility it is to perform comment moderation.

If you ever feel dissatisfied with the default user roles in WordPress, I recommend that you give the Capability Enhanced Manager plugin a try. This will give you a greater amount of control over how users interact with your website.

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.