Uses
Uses | Description |
---|---|
wp-includes/option.php: update_option() | Updates the value of an option that was already added. |
wp-includes/option.php: get_option() | Retrieves an option value based on an option name. |
Remove role by name.
(string) (Required) Role name.
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' ); } }
Version | Description |
---|---|
2.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_roles/remove_role