Back to Top

How to Add User Roles and Capabilities in WordPress

User Roles in Wordpress

WordPress is one of the best and flexible content management system.In WordPress, You can create new user roles, which have specific access to various parts of the admin. after that, you can create users and associate a user to the role you created.

This tutorial will walk you through setting up new user roles in WordPress and allowing them the necessary access to features within the WordPress content management system.

See about: Share user Data in multiple WordPress Installation

Ok, we’ll start by dive into the codes in which you need to define global variable $wp_roles then after adding new roles you want to define for user using inbuilt function of WordPress add_role.

so Let’s see the code

Here, I have added a new action for adding a new role for the user. same like that you can remove user role using the inbuilt function of WordPress remove_role.

Also Like: To Get number of comments of a post

Users and user roles are necessary parts of setting up any site that is going to be managed by more than one person.It’s pretty simple and easy, so don’t bother to use it in your development.

Thank you for reading.Feel free to share your thoughts! Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Leave a Reply

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

Most Popular Posts

The Readers’ Poll – June 2013

Posted on 4 years ago


How to Prepare data in CodeIgniter

Posted on 6 years ago


PHP 7 new Features at a Glance

Posted on 2 years ago


What are Lambdas and Closures in PHP?

Posted on 9 months ago


How To Install Bugzilla on Windows

Posted on 5 years ago