Identify and display the fact that user is admin next to username in comment section
From inside a comment Loop… $author_data = get_user_by(‘login’,$comment->comment_author); if (!empty($author_data)) { var_dump($author_data->roles); } $author_data->roles is an array so you will need to work out what you want to do with that. That is, print them all? Print the highest ranking role? if (array_intersect(array(‘administrator’,’moderator’),$author_data->roles)) { echo ‘admin’; } elseif (array_intersect(array(‘something’,’else’),$author_data->roles)) { echo ‘something else’; }