📜  wordpress 根据用户角色检查用户 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:01.488000             🧑  作者: Mango

代码示例1
$user = wp_get_current_user();
if ( in_array( 'author', (array) $user->roles ) ) {
    //The user has the "author" role
}