How To Add Custom User Role In WordPress

WordPress is one of the most popular CMS ( Content Management System ) in the world right now. It provides some handy features that are sure to give the best user experience. However, among these many features, people often forget about “WordPress user role”, one of the highlighting features of WordPress.

When the site owners install WordPress for the first time, most of the time don’t know they are also getting a role management system. That means, they can assign specific roles to users that will define their access to the admin dashboard. You will not realize it’s importance at first, but as time passes and your website grows, you will know how important this function is.

Today we are going to show how you can set a custom WordPress user role while also discussing the importance of these roles and capabilities. 

Let’s begin, shall we?

WordPress User Roles & Capabilities | Why This Feature Is Important?

Basically, WordPress has six default user roles,

  1. Super Admin: This user is only applicable to multisite WordPress installation. He/She has control over the whole website along with the network administrative feature
  2. Admin: The role is in its name. This user has control over all the administrative features
  3. Editor: This user has the ability to publish and manage posts including the posts of other’s
  4. Author: They can only have access to manage their own posts. They can publish their posts also
  5. Contributor: He/She can only write and manage their own posts but doesn’t have the authority to publish their posts
  6. Subscriber: This user only has permission to manage their profile.

But how dividing roles will help improve your website? 

Suppose you have an author who occasionally writes on your site. So, you want this writer to only create, edit, and sometimes publish his/her content right? You certainly don’t want the writer to access your admin area or touch your settings of the site. It’s not about trust. He/She might accidentally break the design which is not good. 

That is why it is important to have user roles to determine who does what. That way there will be no chance of accidents happening. 

There are two ways to add WordPress user role,

  1. Using a WordPress plugin
  2. Applying custom code

We are going to explain both.

Using A WordPress Plugin

As you know there are more than 50000 plugins available in the WordPress repository. So, it’s certain there would be a plugin that helps you add custom user role to your WordPress website. 

Among the many custom user role plugins we tested, the member’s plugin was the most simple. It was perfect for even beginners to understand and it has all the functionalities you need. 

The process is simple,

  • Install the plugin like any other WordPress plugin on your website.
  • After installing, activate and go to  admin-> Users -> add role
  • Add a role name which reflects the role like Comment moderator
  • Next, select what this new role can do in your site
  • Finish with hitting the Add Role button.
  • You are done.

custom role using WordPress Plugin

See, you only needed 5 steps to add a new user role on your WordPress website using a plugin. 

Applying Custom Code

Although it is quite easy to add custom user role using WordPress plugins, sometimes installing too many plugins on your website will slow down your website thus hampering your website’s performances. 

That’s why many users recommend applying custom code to your WordPress site to add custom user roles. As WordPress is an open-source platform it is quite easy to add extra codes to modify the website per user’s preferences.

So we are going to show you how to add a custom user role using codes.

You need to add this code “ add_role( (string)$role, (string)$display_name, (array)$capabilities );” to create a new custom role. In the code 

$role defines a unique name for your user role,

$display_name the name that will display in the admin panel

$capabilities what the role can do

It’s confusing, right? Why don’t we show you practically? 

Suppose you want to add a ‘writer’ role. Go to the functions.php file which is located on your theme folder.

WordPress Admin → Appearance → Editor → Theme functions.

Copy the following code and paste it on the Theme function file. And click the update file button.

add_role('writer', __('Writer'),

      'read'            => true, // Allows a user to read
      'create_posts'      => true, // Allows user to create new posts
      'edit_posts'        => true, // Allows user to edit their own posts
       'manage_categories' => true, // Allows user to manage post categories
Adding new Role on theme functions. php
Adding new Role on theme functions.php

Now save the file to finish. Your custom user role is finished. Now, navigate to Dashboard->Users-> All users. There select any user and assign this custom role.

You can also watch this video to learn more about creating custom user capabilities.

Create Custom User Capabilities in WordPress

That’s it. 

There you see, how easy it is to add a WordPress user role using custom codes. 


WordPress has many customizations options. WordPress’ custom user role is just one of them. You can’t learn it all at once. However, if you try and be persistent WordPress isn’t hard to figure out.

And we hope this article will help you take a step forward to it.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *