Removes a role, if it exists.
Parameters
$rolestringrequired- Role name.
Source
function remove_role( $role ) {
wp_roles()->remove_role( $role );
}
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
Removes a role, if it exists.
$rolestringrequiredfunction remove_role( $role ) {
wp_roles()->remove_role( $role );
}
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
Example
Remove the ‘subscriber’ role if it exists.