Sélectionner une page

A Detailed Guide on WordPress & WooCommerce User Role Editor

A Detailed Guide on WordPress & WooCommerce User Role Editor

banner image for user role editor article

As you know, WordPress user roles make it extremely easy to handle different users and their capabilities on your website. In addition to the default user roles of WordPress, WooCommerce adds two more user roles when you install it. Though WordPress and WooCommerce do not offer too much customization options for user roles and permissions, you can use the User Role Editor plugin to modify roles in your site. In this article, we will demonstrate how you can customize the WordPress and WooCommerce user role system with the help of the User Role Editor plugin.

A quick recap of WordPress and WooCommerce user roles

WordPress offers a range of user roles that will help you manage how different users access your site. The default roles of WordPress are as follows:

  • Administrator
  • Editor
  • Author
  • Contributor
  • Subscriber
  • Super Admin.

When you install WooCommerce, two additional user roles will be available to you. These are:

All these default user roles will have specific capabilities assigned to them. WordPress and WooCommerce do not offer any option to edit the capabilities of each of these roles. You will have to install a plugin to be able to create custom user roles, and also modify the capabilities of each role. In this article, we will discuss how you can use the User Role Editor plugin to create custom user roles as well as modify the set of capabilities for each user role on your site.

Getting started with the User Role Editor plugin

You can get started with this plugin just like you would for any other WordPress plugin. It is free to download in the WordPress plugin repository. Simply install and activate it.

If you need help to install and set up a plugin, please read How to Install and Set Up a WordPress WooCommerce Plugin.

Once you install and activate the plugin, you can access its settings from the WordPress admin panel by going to Users > User Role Editor.

Here you will be able to view all the customization options provided by this plugin.

First, you will see a drop-down to select the role that you would want to change the capabilities.

Below that you will see two checkboxes to display capabilities in human readable form, and to display deprecated capabilities.

You will also see all the available capabilities listed on the page. On the left side of the capabilities, you can select a Group to see only selected capabilities. There are also options to filter capabilities by typing a keyword, or by only selecting the ones that are granted to the selected role.

And on the right side, you will see the following buttons.

  • Update
  • Add Role
  • Rename Role
  • Add Capability
  • Delete Capability
On the plugin settings page, you can view all the capabilities available to customize user roles.

How to selectively add additional capabilities to an existing role?

You can use this plugin to add additional capabilities to a role. Here is how.

Step 1: Select the role you want to edit.

First, you need to select the role that you want to add more capabilities. For this example, we will choose the ‘Contributor’ role.

You need to first select a user role.

Step 2: Choose the capabilities you want to provide to this role.

You can tick the checkbox next to any of the capabilities that you want to provide to this role.

For example, we are adding a capability to ‘Read private pages’ to this role.

Choose any capability that you want to assign to the role.

Step 3: Click the Update button.

Finally, update the changes.

Screenshot of updating capabilities for a role using User role Editor plugin
You can save the changes by clicking the update button.

How to create a custom user role?

With the help of the User Role Editor plugin, you can also create custom user roles in addition to the default WordPress user roles.

For this, you need to click the Add role button.

screenshot highlighting the Add role button for User Role Editor plugin
The plugin helps you create new roles.

A modal window will be displayed. Here, you need to enter the following details:

  • Role Name (ID) – The role name for the understanding of the site admins.
  • Display role name – The role name that will be displayed on the site’s frontend.
  • Make copy of – You can also copy the capabilities of one of the existing roles from your site, while creating a new role. This will make the task easier.

You can enter the necessary details and click the Add Role button.

You can create a new role without any capabilities or copy an existing role.

Once the role is created, it will be available in the dropdown list for roles, if you need to access it for further customization.

How to add additional capabilities to WooCommerce customers?

Once you have installed and activated WooCommerce, there will be two more default roles in your site – ‘Customer’ and ‘Shop Manager’.

You can use the User Role Editor plugin to add capabilities to these roles as well.

For example, we will show how to assign additional capabilities to the Shop Manager role.

The Shop Manager role does not have the capability to create users or role on the site. We can assign it by simply choosing these two capabilities from the list, and then click the Update button.

Simply tick the checkboxes corresponding to the additional capabilities.

Now the Shop Manager role will have these additional capabilities.

How to delete a user role?

The User Role Editor plugin helps you delete custom user roles. You can even delete the default roles of WooCommerce in this manner. Simply click the Delete Role button, and select the one you want to delete from the dropdown.

You can delete any custom roles including WooCommerce roles, but not the WordPress default ones.

How to edit the WordPress admin role?

You can choose to edit the Administrator user role, and also allow custom roles to copy its capabilities. However, this is not available by default, though you can make changes in the plugin settings. For this, you need to access the plugin settings from the WordPress admin panel by going to Settings > User Role Editor.

This will make the Administrator role for editing.

The plugin allows customization of the Admin role as well.

How to set a role as default for new user creation?

Another interesting feature of the plugin is that you can customize the role that will be assigned to a user by default when they register. By default, this is the Subscriber role. However, you can change this using the plugin.

Go to Settings > User Role Editor. Under the Default Rules tab, you can select a role that you want to be assigned by default to new users.

Change the default role for new users.

How to assign multiple roles to the same user?

With this plugin, you can assign multiple roles to the same user.

This is how you can manage it.

Go to the individual user profile, scroll down to ‘Other roles’. Select the role(s) you want to add and click the Save changes button.

Multiple roles can be assigned to the same user.

We hope this article has provided you with a good understanding on the User Role Editor plugin, and how you can achieve different use cases with it. Please feel free to leave a comment if you have any queries.

Further reading

Poster le commentaire

Votre adresse e-mail ne sera pas publiée.