Creating New User Roles in WordPress with Members Plugin
WordPress offers a number of user roles out of the box that enables you to grant or limit access to the back-end of your site as needed.And while the default user roles will do the job most of the time, there may be occasion where you need what would be seen as a custom user role that provides different access than the default user roles. there are a few ways you can accomplish this, both via code and plugin. In this article we are going to take the plugin route and examine how to add new user roles to WordPress with the plugin Members. The Members plugin does a lot of things well, but for me it is the go to plugin when I need to create custom user roles on WordPress sites.
For this tutorial we are going to create a new user role called “Demo Role”. For the sake of this tutorial, all we are going to allow people with user role to do is the following:
- Publish Posts
- Edit Posts
- Delete Posts
- Publish Pages
- Edit Pages
- Delete Pages
- Switch Themes
So now that we have defined what we want the capabilities of this new user role to be, let’s get down to the business of creating this new role.Once you’ve downloaded and installed the plugin, you will see the User section in your WordPress dashboard has expanded a bit to accommodate the new functionality of the plugin. You now have the ability to not only create new user roles but edit the existing ones as well. We will stick to creating our new Demo Role for now.
When you click ” Add New Role” you are presented with the screen that you will use to create our new role. After filling out the required fields for the Role Name and Role Label, you then choose the capabilities the new role has by checking the corresponding boxes nest to the function you wish to enable. Based on our role definition above , your screen would look like this:
Once you have chosen the capabilities you wish to grant for this role, simply click the “Add Role” button at the bottom and your new role is ready to be applied to users.
If you wanted to test out the new role and make sure it works as you envisioned it, simply add a new user with that role and log in as them ( make sure you aren’t changing your admin account, otherwise you won’t be able to log back in as an administrator). As you’re setting up your new user, you will see the newly created role is now available in the drop down box where you assign roles to new users.
Now, Simply log out of your site and log back in as your new user. If all has gone correctly , you should now see a stripped down list of options available in the dashboard to this user as seen in this screen shot to the left. And just like that you have created your very own custom roles inside WordPress.