Call   0208 3131682   Mon-Fri 9am-6pm

How to get a users Roles and how to list all WordPress roles in PHP

By May 5, 2017 PHP, Programming, Wordpress

This code is handy if you want to find out a users role/s. You could expand it and check if a user has a given role or similar.

This code is based on examples from:


If you did want to check if the user is in a certain group you could do something like this:


One Comment

  • Debbie says:

    Nice! Can you suggest a way to find the highest level role for a single user? Many times users have multiple roles. I am looking to find and return the highest access, such as editor or administrator.

Leave a Reply