role_has_cap filter-hookWP 2.0.0

Filters which capabilities a role has.

Usage

add_filter( 'role_has_cap', 'wp_kama_role_has_cap_filter', 10, 3 );

/**
 * Function for `role_has_cap` filter-hook.
 * 
 * @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.
 *
 * @return bool[]
 */
function wp_kama_role_has_cap_filter( $capabilities, $cap, $name ){

	// filter...
	return $capabilities;
}
$capabilities(bool[])
Array of key/value pairs where keys represent a capability name and boolean values represent whether the role has that capability.
$cap(string)
Capability name.
$name(string)
Role name.

Changelog

Since 2.0.0 Introduced.

Where the hook is called

WP_Role::has_cap()
role_has_cap
wp-includes/class-wp-role.php 95
$capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );

Where the hook is used in WordPress

Usage not found.