WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/set user role

This page is marked as incomplete. You can help Codex by expanding it.

Description

The 'set_user_role' action hook triggers any time a users role is changed.

Parameters

$user_id
(int) (required) The user's ID
Default: None
$role
(string) (required) The user's "new" role
Default: None
$old_roles
(array) (optional) The user's previous role(s). Added in v3.6.
Default: None

Source File

'set_user_role' is location in wp-includes/capabilities.php