wp_roles not working
-
Hello
Im trying to print the second role of the current user logged in, but $wp_roles wont work.
This is my code:
$user = wp_get_current_user(); $role = $user->roles[1]; $role_name = $wp_roles->roles[$role]['name']; echo $role_name
Why will it not work? And what can I do instead?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘wp_roles not working’ is closed to new replies.