WordPress at a glance
function is not described

WP_Role::has_cap() public WP 2.0.0

Determines whether the role has the given capability.

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

Hooks from the method
Return

true/false. Whether the role has the given capability.

Usage

global $wp_role;
$wp_role->has_cap( $cap );
$cap(string) (required)
Capability name.

Changelog

Since 2.0.0 Introduced.

Code of WP_Role::has_cap() WP 5.5.1

<?php
public function has_cap( $cap ) {
	/**
	 * Filters which capabilities a role has.
	 *
	 * @since 2.0.0
	 *
	 * @param bool[] $capabilities Array of key/value pairs where keys represent a capability name and boolean values
	 *                             represent whether the role has that capability.
	 * @param string $cap          Capability name.
	 * @param string $name         Role name.
	 */
	$capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );

	if ( ! empty( $capabilities[ $cap ] ) ) {
		return $capabilities[ $cap ];
	} else {
		return false;
	}
}