返回介绍

is_network_admin()

发布于 2017-09-11 01:20:09 字数 2948 浏览 844 评论 0 收藏 0

is_network_admin()

Whether the current request is for the network administrative interface.


description

e.g. /wp-admin/network/

Does not check if the user is an administrator; current_user_can() for checking roles and capabilities.


返回值

(bool) True if inside WordPress network administration pages.


源代码

File: wp-includes/load.php

function is_network_admin() {
	if ( isset( $GLOBALS['current_screen'] ) )
		return $GLOBALS['current_screen']->in_admin( 'network' );
	elseif ( defined( 'WP_NETWORK_ADMIN' ) )
		return WP_NETWORK_ADMIN;

	return false;
}

更新日志

Versiondescription
3.1.0Introduced.

相关函数

Used By

  • wp-admin/includes/class-theme-upgrader-skin.php: Theme_Upgrader_Skin::after()
  • wp-admin/includes/class-theme-installer-skin.php: Theme_Installer_Skin::after()
  • wp-admin/includes/ms.php: _access_denied_splash()
  • wp-admin/includes/update.php: wp_plugin_update_row()
  • wp-admin/includes/dashboard.php: wp_dashboard_right_now()
  • wp-admin/includes/dashboard.php: wp_dashboard_setup()
  • wp-admin/includes/class-wp-plugin-install-list-table.php: WP_Plugin_Install_List_Table::display_rows()
  • wp-includes/l10n.php: load_default_textdomain()
  • wp-includes/general-template.php: add_thickbox()
  • 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()
  • wp-includes/user.php: wp_validate_logged_in_cookie()
  • wp-includes/script-loader.php: wp_default_scripts()
  • Show 10 more used by Hide more used by

User Contributed Notes

  1. Skip to note content You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note Contributed by Codex

    Check if current screen is network admin screen

    
    if ( is_network_admin() ) {
    	echo __( 'You are viewing a WordPress network administration page', 'textdomain' );
    } else {
    	echo __( 'You are not viewing a WordPress network administration page', 'textdomain' );
    }
    
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文