WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/user can

Contents

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.

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.