Uses
Uses | Description |
---|---|
wp-includes/class-wp-role.php: role_has_cap | Filters which capabilities a role has. |
wp-includes/plugin.php: apply_filters() | Calls the callback functions that have been added to a filter hook. |
Determines whether the role has the given capability.
(string) (Required) Capability name.
(bool) Whether the role has the given capability.
File: wp-includes/class-wp-role.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; } }
Version | Description |
---|---|
2.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_role/has_cap