Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get User's Capabilities
<?php
/**
* 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 );
}
@julianojacob

This comment has been minimized.

Copy link

commented Mar 25, 2019

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
You can’t perform that action at this time.