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.
定义位置
相关方法
get_profileget_localeget_user_localeget_rssget_footer
引入
2.0.0
弃用
-

get_role函数是一个WordPress的函数,通过它的名字检索一个角色对象: 这个函数接受角色名称作为参数,并返回角色对象。

检索角色对象。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_role( $role ) {
return wp_roles()->get_role( $role );
}
function get_role( $role ) { return wp_roles()->get_role( $role ); }
function get_role( $role ) {
	return wp_roles()->get_role( $role );
}

常见问题

FAQs
查看更多 >