WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/user can

Description

Whether a user has capability or role. Similar to current_user_can(), but this function takes a user ID or object as its first parameter.

While checking against particular roles in place of a capability is supported in part, this practice is discouraged as it may produce unreliable results.

Usage

 <?php user_can$user$capability ); ?> 

Parameters

$user
(object or integer (ID)) (required) required
Default: None
$capability
(string) (required) capability or role name.
Default: None

Returns

(boolean) 
user has capability or role.

Changelog

Since: Version 3.1

Source Code

user_can() is located in wp-includes/capabilities.php.

Related

User Capabilities: user_can(), current_user_can(), current_user_can_for_blog()

See also index of Function Reference and index of Template Tags.