Issue
How to get the currently logged in user's role in wordpress?
Solution
Assuming you have the user id ($user_id) something like this should work:
$user = new WP_User( $user_id );
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
echo $role;
}
Get the user id from your session.
Answered By - dnatoli Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.