You may want to get the role of a WordPress user by ID or even the role of the current user.

First off, if you’re doing this for the current user, you can use the global $user_ID variable as the current user ID.

Here is a quick function you can use to get the role of a WordPress user by user ID:

<?php

function get_user_role() {
	global $user_ID;
	$user = new WP_User($user_ID);
	$role = array_shift($user -> roles);
	return $role;
}

?>