WP_Roles::remove_role( string $role )
Remove role by name.
Description Description
Parameters Parameters
- $role
-
(string) (Required) Role name.
Source Source
File: wp-includes/class-wp-roles.php
public function remove_role( $role ) { if ( ! isset( $this->role_objects[ $role ] ) ) { return; } unset( $this->role_objects[ $role ] ); unset( $this->role_names[ $role ] ); unset( $this->roles[ $role ] ); if ( $this->use_db ) { update_option( $this->role_key, $this->roles ); } if ( get_option( 'default_role' ) == $role ) { update_option( 'default_role', 'subscriber' ); } }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |