src/Role_Command.php
public function delete( $args ) {
		global $wp_roles;

		self::persistence_check();

		$role_key = array_shift( $args );

		if ( empty( $role_key ) || ! isset( $wp_roles->roles[ $role_key ] ) ) {
			WP_CLI::error( 'Role key not provided, or is invalid.' );
		}

		remove_role( $role_key );

		// Note: remove_role() doesn't indicate success or otherwise, so we have to
		// check ourselves
		if ( ! isset( $wp_roles->roles[ $role_key ] ) ) {
			WP_CLI::success( "Role with key '{$role_key}' deleted." );
		} else {
			WP_CLI::error( "Role with key '{$role_key}' could not be deleted." );
		}

	}
public function delete( $args ) {
		global $wp_roles;

		self::persistence_check();

		$role_key = array_shift( $args );

		if ( empty( $role_key ) || ! isset( $wp_roles->roles[ $role_key ] ) ) {
			WP_CLI::error( 'Role key not provided, or is invalid.' );
		}

		remove_role( $role_key );

		// Note: remove_role() doesn't indicate success or otherwise, so we have to
		// check ourselves
		if ( ! isset( $wp_roles->roles[ $role_key ] ) ) {
			WP_CLI::success( "Role with key '{$role_key}' deleted." );
		} else {
			WP_CLI::error( "Role with key '{$role_key}' could not be deleted." );
		}

	}
public function delete ( $ args ) { global $ wp_roles ; self :: persistence_check ( ) ; $ role_key = array_shift ( $ args ) ; if ( empty ( $ role_key ) || ! isset ( $ wp_roles -> roles [ $ role_key ] ) ) { WP_CLI :: error ( 'Role key not provided, or is invalid.' ) ; } remove_role ( $ role_key ) ; // Note: remove_role() doesn't indicate success or otherwise, so we have to // check ourselves if ( ! isset ( $ wp_roles -> roles [ $ role_key ] ) ) { WP_CLI :: success ( "Role with key '{$role_key}' deleted." ) ; } else { WP_CLI :: error ( "Role with key '{$role_key}' could not be deleted." ) ; } }
Deletes an existing role.

## OPTIONS

<role-key>
: The internal name of the role.

## EXAMPLES

# Delete approver role.
$ wp role delete approver
Success: Role with key 'approver' deleted.

# Delete productadmin role.
wp role delete productadmin
Success: Role with key 'productadmin' deleted.
Deletes an existing role .