Answers for "wordpress built-in function to get user role"

PHP
2

wordpress get current user role

$user = wp_get_current_user();
if ( in_array( 'author', (array) $user->roles ) ) {
    //The user has the "author" role
}
Posted by: Guest on February-13-2021

Code answers related to "wordpress built-in function to get user role"

Browse Popular Code Answers by Language