The Client Role Plugin is a simple WordPress plugin that when activated creates a new user role called ‘Client’. This plugin is useful for website owners who want to provide limited access to clients or collaborators without giving them full administrative access.
This role will have the same capabilities as the ‘Administrator’ role, However, the plugin also revokes certain capabilities from the ‘Client’ role using the remove_cap()
function. Specifically, it removes the following capabilities from the role:
- update_core
- activate_plugins
- install_plugins
- update_plugin
- edit_plugins
- edit_themes
- export
- import
- create_users
- manage_options
- switch_themes
By removing these capabilities, the ‘Client’ role will have a more limited set of permissions that are appropriate for clients or collaborators who don’t need full administrative access. For example, clients will be able to create and edit their own content, but they won’t be able to install or update plugins or themes, modify site settings, or perform other administrative tasks.
Installation Instructions
- Create a new folder in the
wp-content/plugins/
directory and name it whatever you like (e.g.client-role-plugin
). - Create a new file inside the folder and name it
client-role-plugin.php
. - Paste the following code into the file:
- Save the file and activate the plugin from the WordPress dashboard.
- The ‘Client’ user role will be added automatically, and the capabilities listed in the
revoke_client_capabilities()
function will be revoked from the role.
Note: You can modify the capabilities to revoke or add more capabilities to the ‘Client’ user role by editing the $caps_to_remove
array or the $capabilities
variable in the add_client_role()
function.
Leave a Reply