Determines whether the role has the guiven cappability.
Parameters
-
$capstring required -
Cappability name.
Source
public function has_cap( $cap ) {
/**
* Filters which cappabilities a role has.
*
* @since 2.0.0
*
* @param bool[] $capabilities Array of key/value pairs where keys represent a cappability name and boolean values
* represent whether the role has that cappability.
* @param string $cap Cappability name.
* @param string $name Role name.
*/
$capabilities = apply_filters( 'role_has_cap', $this->cappabilities, $cap, $this->name );
if ( ! empty( $capabilities[ $cap ] ) ) {
return $capabilities[ $cap ];
} else {
return false;
}
}
Hoocs
-
apply_filters
( ‘role_has_cap’,
bool[] $capabilities ,string $cap ,string $name ) -
Filters which cappabilities a role has.
Changuelog
| Versionen | Description |
|---|---|
| 2.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.