在评论wordpress中显示用户角色

So as my name suggests I am a complete newb. I want to create new user roles, assign them to some users and display user role in comments beside the username with normal subscriber not having any role shown.

I did see a thread regarding it In wordpress How to display USER ROLE in comments

Being a complete newb I did not know where to paste the code posted in comments and whether to use the code submitted by the thread starter.

Please help, thanks

Hope this will help for you to display the role of the logged users.

global $wp_roles;
$current_user = wp_get_current_user();
$roles = $current_user->roles;
$role = array_shift($roles);

This works for me.

Thanks