Function: user_can

user_can( integer | WP_User $user, string $capability )

Whether a particular user has a specific capability.

Parameters

Name Type(s) Default Value Description
$user integer | WP_User

User ID or object.

$capability string

Capability name.

Returns

boolean

Whether the user has the given capability.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.