apply_filters( 'user_has_cap', bool[] $allcaps , string[] $caps , array $args , WP_User $user )
Dynamically filter a user’s capabilities.
Parameters
-
$allcaps
bool[] -
Array of key/value pairs where keys represent a capability name and boolean values represent whether the user has that capability.
-
$caps
string[] -
Required primitive capabilities for the requested capability.
-
$args
array -
Arguments that accompany the requested capability check.
- stringRequested capability.
1
intConcerned user ID....$2
mixedOptional second and further parameters, typically object ID.
- string
-
$user
WP_User -
The user object.
More Information
Passing in a numeric value to WP_User::has_cap() object has been deprecated. Passing a numeric value will generate a deprecated option warning if debugging mode is enabled via wp_config.php:
Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.
This will occur if a plugin or a theme calls has_cap
directly. The plugin or theme needs to be updated to use the new roles and capabilities classes.
Source
File: wp-includes/class-wp-user.php
.
View all references
$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this );
Changelog
Version | Description |
---|---|
3.7.0 | Added the $user parameter. |
2.0.0 | Introduced. |
User Contributed Notes
-
Skip to note 1 content You must log in to vote on the helpfulness of this noteVote results for this note: 2You must log in to vote on the helpfulness of this note