函数原型
get_role( string $role ): WP_Role|null
函数描述
Retrieves role object.
是否弃用
未弃用
函数参数
-
$role
string
Required - Role name.
函数返回值
WP_Role|null WP_Role object if found, null if the role does not exist.
函数位置
File: wp-includes/capabilities.php.
函数源码
function get_role( $role ) {
return wp_roles()->get_role( $role );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |

