函数原型:
get_role( string $role ): WP_Role|null
检索角色对象。
参数说明:
$role,角色名称。
函数源码:
function get_role( $role ) {
return wp_roles()->get_role( $role );
}
使用举例:
$admin_role = get_role( 'administrator' )->capabilities;
输出结果:
Array
(
[switch_themes] => 1
[edit_themes] => 1
[activate_plugins] => 1
[edit_plugins] => 1
[edit_users] => 1
[edit_files] => 1
[manage_options] => 1
[moderate_comments] => 1
[manage_categories] => 1
[manage_links] => 1
[upload_files] => 1
[import] => 1
[unfiltered_html] => 1
[edit_posts] => 1
[edit_others_posts] => 1
[edit_published_posts] => 1
[publish_posts] => 1
[edit_pages] => 1
[read] => 1
[level_10] => 1
[level_9] => 1
[level_8] => 1
[level_7] => 1
[level_6] => 1
[level_5] => 1
[level_4] => 1
[level_3] => 1
[level_2] => 1
[level_1] => 1
[level_0] => 1
[edit_others_pages] => 1
[edit_published_pages] => 1
[publish_pages] => 1
[delete_pages] => 1
[delete_others_pages] => 1
[delete_published_pages] => 1
[delete_posts] => 1
[delete_others_posts] => 1
[delete_published_posts] => 1
[delete_private_posts] => 1
[edit_private_posts] => 1
[read_private_posts] => 1
[delete_private_pages] => 1
[edit_private_pages] => 1
[read_private_pages] => 1
[delete_users] => 1
[create_users] => 1
[unfiltered_upload] => 1
[edit_dashboard] => 1
[update_plugins] => 1
[delete_plugins] => 1
[install_plugins] => 1
[update_themes] => 1
[install_themes] => 1
[update_core] => 1
[list_users] => 1
[remove_users] => 1
[promote_users] => 1
[edit_theme_options] => 1
[delete_themes] => 1
[export] => 1
[list_roles] => 1
[create_roles] => 1
[edit_roles] => 1
[delete_roles] => 1
[edit_role_menus] => 1
[edit_posts_role_permissions] => 1
[edit_pages_role_permissions] => 1
[edit_nav_menu_permissions] => 1
[edit_content_shortcodes] => 1
[delete_content_shortcodes] => 1
[edit_login_redirects] => 1
[delete_login_redirects] => 1
[bulk_edit_roles] => 1
[edit_widget_permissions] => 1
[edit_attachments] => 1
[delete_attachments] => 1
[read_others_attachments] => 1
[edit_others_attachments] => 1
[delete_others_attachments] => 1
[edit_users_higher_level] => 1
[delete_users_higher_level] => 1
[promote_users_higher_level] => 1
[promote_users_to_higher_level] => 1
[manage_capabilities] => 1
)
-
WordPress函数:esc_attr__ 转义属性及翻译WordPress函数:esc_attr__ 转义属性及翻译
-
WordPress函数:esc_attr_e 属性转义、翻译、显示WordPress函数:esc_attr_e 属性转义、翻译、显示
-
WordPress函数:esc_attr_x 带上下文的转义属性,翻译显示WordPress函数:esc_attr_x 带上下文的转义属性,翻译显示
-
WP Multilang WordPress翻译插件WP Multilang插件的主要功能是提供多语言支持,使用户能够创建多语言版本的网站,满足不同语言用户的需求。
-
WordPress公司官网主题在众多的WordPress企业官网主题中,追格公司推出了多款关于WordPress企业官网主题作品。我们之前已经分享过一些关于追格的企业官网主题,包括收费和免费版本,这些主题都因其独特的设计和出色的功能而深受用户喜爱。
-
WordPress必备:使用wp_get_theme()函数获取当前主题详情在WordPress中,wp_get_theme() 函数用于获取当前启用的主题或指定主题的信息。这个函数返回一个 WP_Theme 对象,该对象包含了主题的详细信息,如主题名称、版本、模板目录、样式表目录等。
暂无评论,抢个沙发...