返回介绍

network_admin_url()

发布于 2017-09-11 02:00:01 字数 5470 浏览 1286 评论 0 收藏 0

network_admin_url( string $path = '',  string $scheme = 'admin' )

Retrieves the URL to the admin area for the network.


description


参数

$path

(string) (Optional) path relative to the admin URL.

Default value: ''

$scheme

(string) (Optional) The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.

Default value: 'admin'


返回值

(string) Admin URL link with optional path appended.


源代码

File: wp-includes/link-template.php

function network_admin_url( $path = '', $scheme = 'admin' ) {
	if ( ! is_multisite() )
		return admin_url( $path, $scheme );

	$url = network_site_url('wp-admin/network/', $scheme);

	if ( $path && is_string( $path ) )
		$url .= ltrim($path, '/');

	/**
	 * Filters the network admin URL.
	 *
	 * @since 3.0.0
	 *
	 * @param string $url  The complete network admin URL including scheme and path.
	 * @param string $path Path relative to the network admin URL. Blank string if
	 *                     no path is specified.
	 */
	return apply_filters( 'network_admin_url', $url, $path );
}

更新日志

Versiondescription
3.0.0Introduced.

相关函数

Uses

  • wp-includes/load.php: is_multisite()
  • wp-includes/link-template.php: admin_url()
  • wp-includes/link-template.php: network_site_url()
  • wp-includes/link-template.php: network_admin_url
  • wp-includes/plugin.php: apply_filters()

Used By

  • wp-admin/includes/ms.php: network_edit_site_nav()
  • wp-admin/includes/ajax-actions.php: wp_ajax_search_install_plugins()
  • wp-admin/includes/ajax-actions.php: wp_ajax_search_plugins()
  • wp-admin/includes/ajax-actions.php: wp_ajax_install_theme()
  • wp-admin/includes/ajax-actions.php: wp_ajax_install_plugin()
  • wp-admin/includes/class-wp-ms-sites-list-table.php: WP_MS_Sites_List_Table::handle_row_actions()
  • wp-admin/includes/class-wp-ms-sites-list-table.php: WP_MS_Sites_List_Table::column_blogname()
  • wp-admin/includes/class-wp-ms-sites-list-table.php: WP_MS_Sites_List_Table::column_users()
  • wp-admin/includes/class-wp-ms-users-list-table.php: WP_MS_Users_List_Table::handle_row_actions()
  • wp-admin/includes/class-wp-ms-users-list-table.php: WP_MS_Users_List_Table::column_blogs()
  • wp-admin/includes/class-wp-automatic-updater.php: WP_Automatic_Updater::send_email()
  • wp-admin/includes/class-wp-ms-users-list-table.php: WP_MS_Users_List_Table::get_views()
  • wp-admin/includes/class-wp-plugins-list-table.php: WP_Plugins_List_Table::single_row()
  • wp-admin/includes/ms.php: site_admin_notice()
  • wp-admin/includes/update.php: core_update_footer()
  • wp-admin/includes/update.php: update_nag()
  • wp-admin/includes/update.php: update_right_now_message()
  • wp-admin/includes/dashboard.php: wp_network_dashboard_right_now()
  • wp-admin/includes/class-wp-plugin-install-list-table.php: WP_Plugin_Install_List_Table::display_rows()
  • wp-admin/includes/class-wp-themes-list-table.php: WP_Themes_List_Table::no_items()
  • wp-admin/includes/ajax-actions.php: wp_ajax_query_themes()
  • wp-admin/includes/bookmark.php: wp_link_manager_disabled_message()
  • wp-includes/link-template.php: self_admin_url()
  • wp-includes/link-template.php: get_edit_profile_url()
  • wp-includes/admin-bar.php: wp_admin_bar_site_menu()
  • wp-includes/admin-bar.php: wp_admin_bar_my_sites_menu()
  • wp-includes/admin-bar.php: wp_admin_bar_updates_menu()
  • wp-includes/ms-functions.php: newblog_notify_siteadmin()
  • wp-includes/ms-functions.php: newuser_notify_siteadmin()
  • Show 24 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

    Basic Example

    
    $url = network_admin_url();
    echo $url;
    

    Output: http://www.example.com/wp-admin/network/

    (protocol will be https when appropriate)

    
    // generate url path to Users -> Add New page in the admin and force https
    $url = network_admin_url( 'user-new.php', 'https' );
    echo $url;
    

    Output: https://www.example.com/wp-admin/network/user-new.php

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

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

发布评论

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