WordPress at a glance
filter is not described

user_has_cap filter-hook . WP 2.0.0

Dynamically filter a user's capabilities.

Usage

add_filter( 'user_has_cap', 'filter_function_name_9884', 10, 4 );
function filter_function_name_9884( $allcaps, $caps, $args, $user ){
	// filter...

	return $allcaps;
}
$allcaps(array)
An array of all the user's capabilities.
$caps(array)
Actual capabilities for meta capability.
$args(array)
Optional parameters passed to has_cap(), typically object ID.
$user(WP_User)
The user object.

Notes

  • Since 3.7.0 Added the user object.

Where the hook is called

WP_User::has_cap()
user_has_cap
wp-includes/class-wp-user.php 742
$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this );

Where the hook is used (in WP core)

wp-includes/default-filters.php 565
add_filter( 'user_has_cap', 'wp_maybe_grant_install_languages_cap', 1 );