is_user_admin() - WordPress 函数参考中文文档

返回介绍

is_user_admin()

发布于 2017-09-11 字数1606 浏览 892 评论 0

is_user_admin()

Whether the current request is for a user admin screen.


描述

e.g. /wp-admin/user/

Does not inform on whether the user is an admin! Use capability checks to tell if the user should be accessing a section or not current_user_can().


返回值

(bool) True if inside WordPress user administration pages.


源代码

File: wp-includes/load.php

function is_user_admin() {
	if ( isset( $GLOBALS['current_screen'] ) )
		return $GLOBALS['current_screen']->in_admin( 'user' );
	elseif ( defined( 'WP_USER_ADMIN' ) )
		return WP_USER_ADMIN;

	return false;
}

更新日志

Version 描述
3.1.0 Introduced.

相关函数

Used By

  • wp-admin/includes/dashboard.php:
    wp_dashboard_right_now()
  • wp-admin/includes/dashboard.php:
    wp_dashboard_setup()
  • wp-includes/link-template.php:
    self_admin_url()
  • wp-includes/link-template.php:
    get_edit_profile_url()
  • wp-includes/class-wp-admin-bar.php:
    WP_Admin_Bar::add_menus()
  • wp-includes/admin-bar.php:
    wp_admin_bar_site_menu()
  • Show 1 more used by
    Hide more used by


User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!