Table of Contents
WordPress and WooCommerce come with predefined roles that determine the actions a user can or cannot perform. Knowing these roles ensures your site’s safety and functionality.
1. Understanding Default WordPress User Roles #
- Administrator: Has access to all administrative features.
- Editor: Can manage and publish posts, including the posts of other users.
- Author: Can publish and manage their own posts.
- Contributor: Can write and manage their own posts but cannot publish them.
- Subscriber: Can only manage their profile.
2. WooCommerce User Roles #
Upon installing WooCommerce, the following roles get added:
- Shop Manager: Has access to most of the WooCommerce-related capabilities, including order management, product creation, and viewing reports.
- Customer: A user who has made a purchase or created an account during the checkout process. They can view past orders and manage their personal details.
3. Adding a New User #
- Navigate to your dashboard and go to
Users > Add New
. - Fill in the required user info (username, email, etc.).
- Select the desired role from the dropdown.
- Click “Add New User”.
4. Editing User Roles #
- Go to
Users
in the dashboard. - Hover over a user’s name and click “Edit”.
- Scroll down to the “Role” dropdown to change their role.
- Click “Update User”.
5. Custom User Roles #
For more specific control:
- Using a Plugin: Plugins like User Role Editor or Members let you create custom roles and modify capabilities.
- Manually with Code: This requires PHP knowledge. Use the
add_role()
function to create a new role, and then assign capabilities withadd_cap()
.
6. Important Considerations #
- Limited Admin Access: Only give the Administrator or Shop Manager role to trusted users.
- Capability vs. Role: A role is a set of capabilities. A capability is a specific action, like ‘publish_posts’ or ‘manage_woocommerce’.
7. Removing Roles #
If you don’t need specific roles, remove them via plugins or the remove_role()
function.
8. Resetting Roles #
Some plugins, like User Role Editor, can reset roles to default settings.