Forums
-
- Forum
- Posts
-
- Installing BuddyPress
- 23,840
- How-to & Troubleshooting
- 129,892
- Creating & Extending
- 25,913
- Requests & Feedback
- 9,553
- Third Party Plugins
- 9,834
- Showcase
- 3,316
- Ideas
- 1,404
- Miscellaneous
- 9,183
-
Hi @crehiren
You can do that quite easily. For example, if you wanted to add a new role to the currently logged-in user then you could do this:
// Get a WP_User object for the current user.
$user = wp_get_current_user();
// Use the add_role() method to add the editor role to this user.
$user->add_role( 'editor' );