In wordpress we can extend user role management system. Here in this wordpress tutorial, we will show to add and remove wordpress user roles. There are some free wordpress plugins which will give you option to edit wordpress role system.
Here are some plugins which will extend wordpress role management.
User Role Editor
With User Role Editor WordPress plugin you can change user role (except Administrator) capabilities easy, with a few clicks. Just turn on check boxes of capabilities you wish to add to the selected role and click “Update” button to save your changes. That’s done. Add new roles and customize its capabilities according to your needs, from scratch of as a copy of other existing role. Unnecessary self-made role can be deleted if there are no users whom such role is assigned.
Role assigned every new created user by default may be changed too. Capabilities could be assigned on per user basis. Multiple roles could be assigned to user simultaneously. You can add new capabilities and remove unnecessary capabilities which could be left from uninstalled plugins. Multi-site support is provided.
User Role
The User Role plugin allows you to change wordpress role capabilities. It is a very useful tool when your site has a bunch of visitors or subscribers. The plugin has intuitive and convenient interface so all the site visitors can be easily sorted by roles with a couple of clicks.
- Actions: You can recover wordpress role capabilities.
- Interface: Recover button has confirmation dialogue, so that you won’t reset your settings ocasionaly.
- Display: All role capabilities are separated into groups.
WPFront User Role Editor
This plugin allows you to easily manage user roles within your WordPress site. You can create, edit or delete user roles and manage role capabilities.
Features
- Create new roles.
- Edit or rename existing roles.
- Clone existing roles.
- Manage capabilities.
- Allows you to add role capabilities.
- Change default user role.
- Restore role.
- Assign multiple roles.
Manual Way to Extend WordPress User management system
Using following Code You can Add or Remove wordpress role.
We added “Owner” role in wordpress. For adding new role use following code.
function wpapi_add_role() { add_role( 'owner', 'Owner', array( 'read', 'edit_posts', 'delete_posts', ) ); } add_action( 'init', 'wpapi_add_role' );
Remove existing worpdress roles, Use following code.
function wpapi_remove_role() { remove_role( 'editor' ); remove_role( 'author' ); remove_role( 'contributor' ); remove_role( 'subscriber' ); } add_action( 'init', 'wpapi_remove_role' );
If you want to know more about worpdress roles and capabilities than visit this page. Check “Capability vs. Role Table” section. which is important for developers.