wordpress判断当前user

$user = wp_get_current_user();
    if ( in_array( 'staff', (array) $user->roles ) ) {
        //code here
    }