Skip to content

Instantly share code, notes, and snippets.

@colewinans
Created December 5, 2012 20:42
Show Gist options
  • Save colewinans/4219315 to your computer and use it in GitHub Desktop.
Save colewinans/4219315 to your computer and use it in GitHub Desktop.
WordPress Role Detection
<?php
if ( is_user_logged_in() ) {
$user = new WP_User( $user_ID );
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
echo $role;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment