我想在用户拥有自定义用户角色时显示一些消息。它可以使用原生用户角色,但不能使用自定义用户角色。这是我的代码:
<?php
$user_ID = get_current_user_ID();
$user = new WP_User( $user_ID );
$current_user = $user->roles[0];
if( $current_user == 'client' ){
echo 'hello client';
} else {
// do nothing
}
?>
任何帮助都是受欢迎的,谢谢!