Merhaba, profil sayfası yapıyorum. Profil sayfasında kullanıcının rolünü göstermek istiyorum. Elimde bir kod var fakat bu kod sadece author.php sayfasında çalışıyor özel bir sayfada kod çalışmıyor yardımcı olabilecek var mı?

Kodlar:

Kod:
<?php $aid = get_the_author_meta('ID'); 
$rolu = get_user_role($aid); 
if ('subscriber' === $rolu){
  echo "Subscriber";
}elseif ('editor' === $rolu){
	  echo "Editör";
}
?>

function.php
function get_user_role($id) {

    $user = new WP_User($id);

    return array_shift($user->roles);

}