In the following guide, we learn how to fix the roles and permissions issues in WordPress. Here, we also learn how to reset the roles to the default state that may have been changed by the plugins.
In the end, we will learn how to manage user roles and capabilities at a user level.
First of all, we need to install and activate the User Role Editor plugin. Using this plugin, we can add, delete, or modify roles and permissions. Also, we can perform a complete reset of the roles and permissions in WordPress.
Managing the Roles and Permissions
After activating the User Role Editor plugin, you will see a new menu page under “Users” > “User Role Editor”. Here, we can see all the existing roles with their permissions (also known as capabilities).
Here, you can do the following:
- Select an existing role and change its capabilities.
- Add a new role, or rename existing roles.
- Add a new capability or permission.
Changing the Roles and Permissions at a User Level
To change the roles and capabilities at a user level, go to the “Users” menu page. Here, for each of the users, you will see many different options to view and modify the capabilities and roles for those users.
Also, when you edit the user, you will see a new option to assign additional roles and edit capabilities for that specific user.
How to Reset the Roles and Permissions
You might have installed a plugin like WooCommerce, BuddyPress, or any other plugin that might have added additional roles and capabilities. Even after removing those plugins, such roles and capabilities might stay and can cause several issues. So, you may want to reset the roles and capabilities to the default state for every user.
The User Role Editor plugin provides an option to reset the roles. First of all, go to “Settings” > “User Role Editor”. Then, in the “Tools” tab, you have the option to reset the roles and capabilities of all the users at once.
You will only want to reset the roles when you are sure that the plugin that changed the default roles or added new roles is not needed anymore. Also, if there is something that might have broken the default roles and permissions of WordPress.
Redirecting the Users based on the Role after the Login
If you are looking to redirect users based on their roles after login or logout, then you may want to check out the premium plugin Login Security Pro. Using this plugin, you can set multiple redirect rules on the basis of roles.
For example, you can redirect all the users with the role “Subscriber” to some specific page. At the same time, you can also redirect all the users with the role “Editors” to a different page after the login or logout.
In this way, you can set as many rules as you want for redirection after the login and logout.