WordPress and WooCommerce user roles help a lot in controlling site access and content access for site owners. As you may already know, WordPress and WooCommerce offers some default user roles with fixed capabilities. You can further customize this user role system for specific business needs like tiered wholesale pricing, membership-level based content, etc. In order to improve your user role system, an important concern would be to create a new user role. In this article, we will discuss how you can create custom user role which derives its capabilities from existing WordPress and WooCommerce user roles.
An overview of WordPress and WooCommerce user roles
When you create a new WordPress website, you will find there are some default user roles associated with WordPress. Each of the default user roles will have a defined list of capabilities associated with them. These user roles will help with your site management as you can assign different roles as per the requirement. On a WordPress site, you will see five major user roles – Administrator, Editor, Author, Contributor and Subscriber. The Administrator role will be the role that is automatically offered to the site owner, who will have all the possible capabilities. And the Subscriber role will be the default role assigned to a new user registering to your site, who will have the capability to only read the content and edit their own profiles.
The other WordPress user roles are related to content creation and publishing. the Editor role will be able to manage the entire content on the site. They can edit and publish the entire content on the site, in addition to moderating comments, and managing Reusable Blocks. The Author role is generally assigned to a self sufficient writer on the site who can create and publish their own content. And the Contributor role will be for someone who will create the content on the site, but will not be able to publish it on their own. They will need to the help and approval of the Editor to publish content.
There is also another important user role that has significance in WordPress multisite networks, called the Super Admin. The Super Admin is equivalent to the single site Administrator. This role will have all the possible capabilities in a multisite network that includes creating and managing individual sites on the network. In a multisite network, the Administrator role will be assigned to those users who will be managing individual sites.
WooCommerce user roles
Now, when you install WooCommerce, two more additional user roles will be available – Customer and Shop Manager. These rules can be considered to be derived from the Subscriber and Editor roles respectively. Apart from viewing the site, the Customer role will be able to manage their own account and view their order history. The Shop Manager role will be able to create and manage products on the store, manage orders, and also view Reports.
Overall, these user roles offer the basic functionalities of user management in a WordPress and WooCommerce website. However, these may not be as flexible when you want to offer selective capabilities to certain users. In such cases you may want to create custom user roles with selective capabilities related to your website or business.
How to create custom user roles?
Though with default WordPress install you can only use the predefined user roles, there are several plugins that will help you create custom user roles and assign capabilities in a selective manner. Here is a quick look at some of these plugins:
This plugin is one of the most popular option to customize WordPress user roles. It will help you create new user roles as well as to modify the capabilities assigned to each user role. You can create a completely new user role and then assign capabilities to it one by one, or you can copy an existing role with all its capabilities and then modify it according to the requirement. The plugin can be also used to delete unnecessary custom roles on your site, and also to assign multiple roles to the same user.
The Members plugin too offers the feature to create custom user roles and assign capabilities to them selectively. In addition, you can use this plugin to restrict content on your site, and also to make your website completely private. You can create totally new roles, or clone existing roles and capabilities according to your needs. The plugin also offers a good foundation to create a full-fledged Membership website.
If you are looking to customize the way you handle user profiles on your WordPress site, this plugin could be a great option. It helps you create appealing user profiles, as well as customizable login and registration forms. For example, you can use this plugin to let customers choose a user role when they register on your site.
How to create a custom user role from an existing WordPress or WooCommerce role?
So, how will you create a custom user role? We will demonstrate this using the User Role Editor plugin. First, you need to install and activate the plugin. You can access the plugin settings from the WordPress admin panel by going to Users > User Role Editor.
Here you will see different capabilities listed, and on the right side, you can see an Add Role button.
Click the Add Role button to create a new user role.
When you click the Add Role button, a new modal window opens that has options to add a name and description to the new role. Along with this, there is a field to specify whether you want to make a copy of any existing role.
For example, if you want to create a new user role that has all the capabilities of the editor role except one, you can copy the role, and then remove just that one capability that you don’t want to offer.
Let’s say you want to create a guest Editor role on your site. You want to offer this new role all the capabilities of the default Editor role, but without the capability to delete content. Here is how you can do it.
First create the role as a copy of the existing Editor role.
Once the role is created, open the role by selecting it in the ‘Select Role and Change its Capabilities’ dropdown. Now, click the ‘Granted Only’ checkbox to view all the capabilities assigned to this role.
For this example scenario, we can simply untick the checkbox for all the delete capabilities, and click the Update button. The newly created Editor role will have all the capabilities of the default Editor role except the right to delete content.
How to create a custom WooCommerce role?
The process is same for WooCommerce roles as well. For example, if you want to create a new Shop Manager role but with no capability to delete, you can follow the same process.
Create a new role as a copy of the Shop Manager role.
View its capabilities, and remove all the ones associated with deleting content, product data, order and coupon information, etc.
We hope this article has helped you understand how to create custom user role from an existing WordPress and WooCommerce user role. Leave a comment if you have a query regarding the process.