How to add and clone user roles in WordPress?

For the beginners WordPress user roles and permissions may be a bit confusing and therefore, today I’m going to give you and overview what is what. Also, I’m going to show you how to add custom user roles on your WordPress site. Or better yet, how to clone user roles on WordPress.

So, let’s dive in.

Video: How to add and clone user roles in WordPress?

What are the default WordPress user roles and permissions?

By default Worpress has six different user roles. Here’s the brief overview of the roles and the permissions every role has.

Super admin user role

Super admins is available only if your have WordPress multi-site feature activated. This user role has access to all the network administration. It is the highest level for the user role. If you don’t have multisite acitvated then the Admin is the one with the highest level permissions.

Admin user role

As said above the Admin user role has the highest level of permissions. That is you can add users (even other admins), install plugins, delete content etc. This is the role that should be protected the most because if someones hacks your admin access you’re probably screwed.

Editor user role

This user role is useful if you have someone who does not have the need to access your site at admin level but who is responsible for managing your site content. Editor is the one who has a full control over the content but does not have permissions to install themes, plugins etc.

What separates editor from authors (see below) is that editors can add additional categories and they may moderate comments.

Author user role

Author user role is also for people who are hired for tasks related to content writing.

As said above authors cannot add additional categories and they cannot moderate comments. They can only add, edit and delete their own posts and nothing else.

Contributor user role

Contributor has even less permissions than authors. What they can do is:

  • create their own posts without the option to publish them. Author user role has an option to publish directly.
  • edit their own posts
  • read all posts

Also, contributors don’t have permissions to upload images which means they can’t even add featured images to the posts.

Subscriber user role

Users with subscriber roles don’t have any permissions except:

  • login to your site and
  • update their user profiles

Subscriber does not have any publishing or editing permissions.

What are the default Woocommerce user roles and permissions?

If youinstall Woocommerce on your site then it will add two additional user roles to your site. So, let’s take a closer look at those roles.

Customer user role

All your new customers who create an accound during the checkout (or on My account page) will be assigned to the Customer user role. This role has basically the same permissions as Subscirber user role with the small difference.

The difference is that customer has an access to the orders history. That is they can see their orders (both past and current) and see their order statuses.

Shop manager user role

Shop manager user role is similar to the customer user role but it has additional permissons. Shop manager can:

  • Manage Woocommerce settings
  • Create/edit/delete products
  • Manage Woocommerce orders
  • Access reports

How to add custom user roles in WordPress?

There are two simple ways how to add custom user roles in Worpress that I’m going to show you. One of these methods uses plugin called Members and the other method uses a small code snippet.

How to add custom user roles with the Members plugin?

It is fairly simple and you need to follow these steps.

  1. Go to Plugins >> Add new and search for Members – Membership & User Role Editor Plugin
  2. Install and activate it
  3. Now you’ll see a Members >> Roles menu on the left. Open it up and you’ll see all the user roles you have on your site.
  4. If you want to add custom WordPress user roles with custom permissions then click on Add new role link or Add new button.
  5. This will open up your role permissions editor that you can use to set the appropriate capabilities for the user role. See the sceenshot below
  6. If eveything is ready then just press on Add role button and you’re done
How to add custom user roles in WordPress?

How to add custom user roles in WordPress without a plugin?

Now let’s see how to add custom user roles in WordPress without a plugin. This time I will clone a user role with all the permissions it has.

If you are like me then you probably don’t like to use plugins for every simple thing. Just grab this piece of code here below and add it to your child theme’s functions.php file.

Or do as I do: I use Code Snippets plugin for adding all sorts of code snippets. Since I already use it for other small snippets on my site I will use that one. PS! After installing and activating the code you can delete it.

Where’s the code? See my next chapter here below..

How to clone user roles in WordPress?

There is two methods. One is with the help of Members plugin and another one is with the help of this code snippet here below. Let’s take a look at the code first.

How to clone user roles in WordPress without a plugin?

Let’s take a look at the code first because you can use this one for both adding or cloning your custom user roles.

// Clone user roles in WordPress
add_action('init', 'clone_wp_role');

function clone_wp_role() {
 $adm = get_role('customer'); // replace the "customer" role if needed
 $adm_cap= array_keys( $adm->capabilities ); //gets user role (customer) capabilities
 add_role('bronze_member', 'Bronze package'); //creates my new role
 $new_role = get_role('bronze_member');
  foreach ( $adm_cap as $cap ) {
   $new_role->add_cap( $cap ); //clone capabilities to new user role
  }
}

Now, couple of things to point out.

  1. As you see I have a user role “customer” on the line 4. This is the user role I am going to clone. If you need to clone Editor user role then replace “customer” with “editor”.

2. On line 6 you need to replace ‘bronze_member’, ‘Bronze package’ accordingly if needed. For example ‘gold_member’, ‘Gold package’ will add a Gold package user role to your site. And this user roles has the permissions from the line 4

3. You need to paste the same slug gold_member’ to the line 7

PS! After installing and activating the code once you can delete it.

How to clone user roles in WordPress with the Members plugin?

  1. Go to Plugins >> Add new and search for Members – Membership & User Role Editor Plugin
  2. Install and activate it
  3. Now you’ll see a Members >> Roles menu on the left. Open it up and you’ll see all the user roles you have on your site.
  4. Hover on the role name and you’ll see a Clone quick edito option (see the screenshot below). Click on Clone.
  5. This will open up your role permissions editor that you can use to modify the capabilities for the user role. Pay attention though that all the permissions and capabilites from the cloned roles is already selected.
  6. If eveything is ready then just press on Add role button and you’re done
How to clone user roles in WordPress

Here are some of my favorite Wordpress tools

Thank you for reading this article. I hope you found it helpful as you build your own websites and e-commerce sites. Here are some tools I use as a Wordpress developer and enthusiast that I hope you’ll also find helpful.

These are affiliate links, so if you do decide to use any of them, I’ll earn a commission and this helps me create these tutorials and make Youtube videos. But in all honesty, these are the exact tools that I use and recommend to everyone, even my friends and family.

Themes: For the last couple of years I have two go-to themes which I use for every kind of projects. Those two themes are Blocksy theme and Kadence Theme. On this site and my Youtube channel you’ll see a lot of tutorials I have made about them. If you would like to get a 10% discount for both of them then:

Contact forms: There are hundreds of contact forms out there but Fluent Forms is the one I like the most. If you need a 20% discount then use this link (save 20% coupon is WPSH20).

Gutenberg add-ons: If I need a good Gutenberg blocks add-on then Kadence Blocks is the one I have used the most. You’ll get 10% discount with the coupon SIMPLEHACKS here.

Website migration: While building a website you probably need a good plugin that can help you with the migration, backups, restoration and staging sites. Well, WpVivid is the one I have used for the last couple of years. If you use this link along with the WPSH20 coupon you’ll get 20% discount.

Woocommerce extensions: There are a bunch of Woocommerce extensions that I really like but the one that stands really out is Advanced Dynamic Pricing. Once again, you’ll get a 20% discount if you use this link here (save 20% coupon is WPSH20)

Web Hosting: For getting started, I really like A2 Hosting. They have the dedicated and fast Wordpress hostinh and support has also been fast and responsive. If you’re more tech savvy and want to have a really fast managed cloud hosting then I recommend Cloudways. (Btw, this site is hosted in Cloudways.)

To see all my of most up-to-date recommendations, check out this resource that I made for you!

Do you want to thank me and buy me a beer?

Every donation is entirely welcome but NEVER required. Enjoy my work for free but if you would like to thank me and buy me a beer or two then you can use this form here below.

Choose amount

Best selling plugins

Default image
Janek T.
I am a Wordpress enthusiast who has been making websites since 2011. In this site I am offering simple to follow tips on how to use Wordpress and Woocommerce. If you want to be the first to be notified about the new tutorials then please subscribe to my Youtube channel here Follow me in Twitter here
Articles: 72