diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index c8d730d53c..4f49ed98f6 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -797,12 +797,12 @@ class WP_User { * @param string $role Role name. */ function set_role( $role ) { - foreach ( (array) $this->roles as $oldrole ) - unset( $this->caps[$oldrole] ); - if ( 1 == count( $this->roles ) && $role == current( $this->roles ) ) return; + foreach ( (array) $this->roles as $oldrole ) + unset( $this->caps[$oldrole] ); + if ( !empty( $role ) ) { $this->caps[$role] = true; $this->roles = array( $role => true );