To get author role in single.php you have to get author id first. Use following code to get author id
$author_id = get_the_author_meta( 'ID' );
Then get userdata using
$user = get_user_by( 'ID', $author_id);
or you can use
$user = get_userdata( $author_id );
now you can display role of author using :
echo implode(', ', $user_info->roles);
Related Posts:
- How to force listing contributors in authors dropdown menu
- Hide specific admin users’ posts
- How to make an author archive only for certain user role and show related CPT
- Allow users to publish child pages of the pages they have access to edit
- Remove wordpress author’s capability to moderate comments on their own posts
- Programmatically allow a non-author to edit a post based custom meta field
- Allow an editor to change the author
- Could we know who published a post on WordPress?
- Admin user name not showing up in author dropdown
- Allow users to change author of post
- Author capabilities: Deleting comments on their own published posts
- Authors Ability to Review Post from Contributors
- allow editors to edit menus?
- How to change a user’s role?
- Is there way to rename user role name without plugin?
- How to create a clone role in wordpress
- How to add a Capability to a User Role?
- Select subscriber as author of post in admin panel?
- How can I get a list of users by their role?
- How to get role of user
- How to allow editor to edit privacy page / settings only?
- How do I make a draft post accessible to everyone?
- Reset default roles and capabilities
- How do I programmatically set default role for new users?
- add_role() run only once?
- What do unfiltered_html and unfiltered_upload actually filter?
- wp_update_user not updating
- Temporary capability for current_user_can()
- Create custom user role (client) that can create another custom user role (employee) of that client
- Publish author posts only with editor approval?
- Is it possible to add new user Roles?
- Allow roles below admin to add subscribers only
- How to let contributors to create a new revision(draft) editing their published posts
- Help to condense/optimize some working code
- Temporarily give ‘manage_options’ capability
- REST API, get user role?
- Is WordPress’ is_user_logged_in() secure?
- Allow authors to edit only certain users
- How do I allow a specific Role in WordPress 3+ to only see certain plugins?
- How to update role capabilities
- Allow editors access to added plugins
- Temporarily disable user role login and replace with message
- How to filter the role selector?
- How to loop through each user id?
- Code needed to only show users own posts in a multi-user account
- How can I change a user role upon visiting a page?
- How to let the Contributor role preview unpublished posts?
- Change role after the user has read all the posts in a category
- Do custom user roles have any default capabilities?
- Filter available WooCommerce payment gateways by role [closed]
- Ordering users of a specific role by last name
- How to programmatically add a user to a role?
- Restrict Author to pick from media library, but not upload media
- Can i copy administrator role to another user?
- how to add custom user capabilities using add_user_meta or something else?
- Assign Subscriber capabilities to a custom user role
- How to change role of all users with a specific role to another role?
- Allow user to Publish, but not Edit or Delete
- Roles at registration (classipress)
- How to allow registered users to change their user role through frontend?
- how to make author to write comment on only his own posts?
- Remove Ability for Administrators to Delete Administrators
- Order users by custom user meta
- how to change user roles for users who doesn’t have any. (about 8000 users)
- List total number of users that are authors
- Email notification for editors only
- Shold I manually add ‘cap’ to admin role ?
- Custom Post Type’s Capabilities map_meta_cap issues
- I need to assign a role to visitors/guests
- Contributors missing from author dropdown
- Getting a user role from the user login name
- Auto Delete Users (auto_delete_users)
- New Roles and Capabilities in WordPress
- Why is wp-login redirecting to the home page when I use this function?
- Allow Content Author to Publish, But Not Edit or Delete
- Is there a way to set the user Role based on email domain
- Allow contributor to view own scheduled post
- Editor and contributor roles not correct after adding function
- Show different badge based upon the user role
- Adding multiple user roles dynamically
- WordPress Super Admin
- pre_get_posts Remove posts based on meta value with ‘post__not_in’
- How to add author role as a custom field to custom post type in wordpress?
- How to prevent users with “edit_others_posts” capability from editing admin posts
- How are roles stored in the database?
- Author Role – Allow editing of Gallery images
- How do I allow anyone to edit a post — but not access dashboard
- What is the difference between “create_users” and “add_users” capabilities?
- How to delete user roles?
- Access on specific pages in wordpress for a specific user
- How to get all users with Author role capabilities?
- How to display user role
- Change the user role after x days
- Get (echo) all role names assigned to user
- How to ‘unpublish’ or ‘hide’ posts when user role changes?
- Prevent author role from editing all posts in custom post type?
- Can’t manage to make translate_user_role() work
- Add Role inherits?
- similar to Editor can create any new user except administrator
- Conditional Tags for Membership Levels when using Wishlist Member Plugin?