tags:

views:

251

answers:

1

How to get the currently logged in user's role in wordpress?

+3  A: 

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.

link664
Thanks, this works for me.
Ravi