Searching the function reference, I was not able to find a function for getting the role name (display name) of a user role.
I finally figured out a way how to get it, which took me half an hour to find out:
$roles = new WP_Roles(); $allroles = $roles->get_names(); echo $allroles[$role]; // $role like 'administrator','author','custom',...
There should be a function for this in the Function Reference. Please correct me if I am wrong or there is a better way.
- The topic ‘Feature Request – Missing Function "get_role_name"’ is closed to new replies.