get_role

函数


get_role ( $role )
参数
  • (string)
    $role
    Role name.
    Required:
返回值
  • (WP_Role|null) WP_Role object if found, null if the role does not exist.
定义位置
  • wp-includes/capabilities.php
    , line 1010
引入
2.0.0
弃用

Retrieves role object.

function get_role( $role ) {
	return wp_roles()->get_role( $role );
}