WordPress at a glance
function is not described

WP_Roles::remove_role() public WP 2.0.0

Remove role by name.

{} It's a method of the class: WP_Roles{}

No Hooks.

Return

null. Nothing.

Usage

global $wp_roles;
$wp_roles->remove_role( $role );
$role(string) (required)
Role name.

Changelog

Since 2.0.0 Introduced.

Code of WP_Roles::remove_role() WP 5.7.2

<?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' );
	}
}