Skip to content

Instantly share code, notes, and snippets.

Last active March 25, 2019 16:01
What would you like to do?
Get User's Capabilities
* Get user's capabilities.
* @param int|WP_User $user The user ID or object. Default is the current user.
* @return array The user's capabilities or empty array if none or user doesn't exist.
function km_get_user_capabilities( $user = null ) {
$user = $user ? new WP_User( $user ) : wp_get_current_user();
return array_keys( $user->allcaps );
Copy link

Where do i have to upload this file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment