Title: display author role?
Last modified: August 19, 2016

---

# display author role?

 *  [SaladGoat](https://wordpress.org/support/users/saladgoat/)
 * (@saladgoat)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/display-author-role/)
 * I want to display the Role of each author on their posts. How can I do this?
   
   Putting the author’s name at the top of the post is easy enough, using this: `
   <?php the_author(); ?>`
 * Is there something similar that I can use to show the author’s Role?
 * The only thing I have found online is this:
 * > function get_the_author_role() {
   >  global $wpdb, $wp_roles, $authordata;
   >  if ( !isset($wp_roles) )
   >  $wp_roles = new WP_Roles();
   >  foreach($wp_roles->role_names as $role => $Role) {
   >  $caps = $wpdb->prefix .‘
   > capabilities’; if (array_key_exists($role, $authordata->$caps)) return $Role;}}
   > /**
   >  * Echo the account role of the author of the current post in the Loop.*
   > [@see](https://wordpress.org/support/users/see/) get_the_author_role() * [@return](https://wordpress.org/support/users/return/)
   > null */ function the_author_role() { echo get_the_author_role(); }
 * But I can’t make it work.
    Isn’t there something shorter?

Viewing 1 replies (of 1 total)

 *  [janew](https://wordpress.org/support/users/janew/)
 * (@janew)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/display-author-role/#post-1516752)
 * I have the same problem.
    Anyone help?

Viewing 1 replies (of 1 total)

The topic ‘display author role?’ is closed to new replies.

## Tags

 * [author](https://wordpress.org/support/topic-tag/author/)
 * [display](https://wordpress.org/support/topic-tag/display/)
 * [role](https://wordpress.org/support/topic-tag/role/)
 * [show](https://wordpress.org/support/topic-tag/show/)

 * 1 reply
 * 2 participants
 * Last reply from: [janew](https://wordpress.org/support/users/janew/)
 * Last activity: [15 years, 11 months ago](https://wordpress.org/support/topic/display-author-role/#post-1516752)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
