0
  1. Subscriber
  2. Administrator
  3. Editor
  4. Author
  5. Contributor

Above are the 3 types of users roles defined in the WordPress. Just like we pull authors description:

<p><?php the_author_meta('description'); ?></p>

How can we pull user role?

1

This was answered here: https://stackoverflow.com/questions/36720949/get-user-role-by-id-wordpress

Here is their answer:

You can't get user role directly. First, you have to get the user_meta_data, and it will return an Object that will contain user roles.

Code:

$user_meta=get_userdata($user_id);

$user_roles=$user_meta->roles; //array of roles the user is part of.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.