As you suggested, here’s how you can display the roles next to the username in the admin bar:
function wpse_203917_admin_bar_menu( $wp_admin_bar ) {
if ( ! $node = $wp_admin_bar->get_node( 'my-account' ) )
return;
$roles = wp_get_current_user()->roles;
$node->title .= sprintf( ' (%s)', implode( ', ', $roles ) );
$wp_admin_bar->add_node( $node );
}
add_action( 'admin_bar_menu', 'wpse_203917_admin_bar_menu' );
Related Posts:
- How to check if a user is in a specific role?
- How to prevent access to wp-admin for certain user roles?
- Check if user is admin by user ID
- Only allow administrators and editors to access wp-admin
- create users to site with specific language
- Prevent from deleting any user role but subscriber
- What is the capability that permits access to WP-Admin?
- How to hide a specific user role option in a user role list?
- Adding HTML/Text to Top of Subscriber’s Profile Backend Page
- Custom role based users are not able to access wp-admin
- Custom roles showing HTML entities in title form field
- Users Unable to Access Dashboard/Posts/Pages
- Only allow administrators and editors to access wp-admin
- Allow administrators to pick post author on custom post type edit screen
- Adding Custom Capabilites
- Restrict Author role to only 3 wp-admin pages
- Why is unfiltered_upload not working despite being enabled?
- Logout USER form backoffice after 30 minutes of inactivity [closed]
- Downgrade admin account by mistake
- How to set where user is redirected to after logging in at wp-login?
- User Capabilities are not available in WP REST permission callback?
- Change users.php WP_User_Query
- User Roles: How to hide a plugin from showing in WP-Admin?
- Is WordPress secure enough for a multi-user article directory?
- Newly created user role not displaying on users screen
- How to check if a user is in a specific role?
- Give wp-admin access for shop managers
- adding existing menu page on new customer user role
- Extend user search in the users.php page to allow for searching by role and excluding specified email domains from the “users search” input box
- how to Hide all products except the General Manager role in the WordPress admin panel?
- adding the category to the admin column for a custom post type?
- Change page title in admin area
- How to filter by post-format in admin?
- sortable custom column in media library
- how do I force a single column layout in screen layout
- Make fonts.com font work in TinyMCE (iframe referrer issue)
- Sortable admin columns, when data isn’t coming from post_meta
- wp_list_table search box does not show
- How to remove the site health dashboard widget?
- Securing wp-admin folder – Purpose? Importance?
- stop redirection on /wp-admin call to /wp-login
- How to Display Post Excerpts in Admin by Default?
- Wp3.5 Media Gallery Edit modal: change captions to title
- WordPress in sub directory wp-admin problem
- Admin account only shows Profile and Dashboard with no activity
- How to display multiple custom columns in the wp-admin users.php?
- WordPress custom permalinks not working on OS X localhost
- 500 Internal Server Error after Register dialog, but with successful registration
- How to Remove Checkbox for Excerpt Under Screen Options
- Change Dashboard url
- WordPress subdomain wp-admin redirects to main domain
- Block access to wp-admin
- Remove order field from Page Attributes box
- CDN + WP Admin Query – .htaccess redirection
- Stop loading “collaborators” users on add new post or page?
- Prevent /wp-admin/ from redirecting to homepage?
- Disable the administration email address verification (new in 5.3)
- WordPress 3.2 Admin UI Guide
- https://mydomain/wp-admin redirects to wp-login.php?redirect_to=https%3A%2F%2Fmydomain%2Fwp-admin%2F&reauth=1
- Password reset link becomes invalid immediately [closed]
- Get which template being in use within WordPress-admin
- special characters after saving draft interpreted as �
- WordPress and bbPress Login conflicts?
- /wp-admin/ works but website doesn’t load
- How can I use a variable to include a linked image?
- Add css code in admin_enqueue_scripts
- Why isn’t my email showing up as registered with WordPress anymore?
- Add custom list menu on Posts page in admin panel
- Unable to locate WordPress Root directory
- Does it matter if two people are using the same WordPress admin account?
- Add column to pages table
- Use Password Protected Form without the use of wp-login.php
- redirect to a dedicated sign in page
- 404 redirect wp-login and wp-admin after changing login url [closed]
- My email address is displaying an email which does not work. What do i do?
- More than one admin logged in?
- How do I let logged out users see the dashboard?
- Too many redirects after added SSL redirect on port 80 virtual host
- Detect Featured Image remove while editing post in wp-admin (client-side)
- Cannot log in to the admin, no error message [closed]
- Create reviews and star-rating for user accounts in wp-admin [closed]
- can’t access backend while frontend works perfect
- How to change home page only in WordPress
- Pages section (only) not loading after publishing large number of pages
- wp-admin 503 error
- Admin Page access
- Add HTML to custom post type edit page
- WP site after login keeps redirecting to looped url [closed]
- Locked out of site admin after change of URL
- Edit “Not Available” Page
- admin-ajax and external service interaction
- Add admin page to the top of the admin panel
- Admin page changes the $_POST data
- Using meta_query in add_query_arg
- Move Custom Taxonomy Menu to Top Level Admin Menu
- get_current_screen() does not return parent_file
- Valid WordPress html elements
- Unable to access WordPress admin panel
- Is it possible to hide or encrypt the display name after login into the WordPress admin panel?
- Error 403 on wp-admin – Redirection to upgrade.php