I am trying to get my frontend to show the role of a logged-in user via Shortcode. I have the Shortcode functional (see below) but it displays the slug and not the real name in the frontend. This is a problem as the slugs are case insensitive and do not display any special characters. How do i get it to display the name rather than the slug?
Any help is greatly appreciated.
// [current_user_role]
function get_user_role() {
global $current_user;
$user_roles = $current_user->roles;
$user_role = array_shift($user_roles);
return $user_role;
}
add_shortcode('current_user_role', 'get_user_role');