network_admin_url()返回后台管理地址(多站点)

目录

描述

The network_admin_url template tag retrieves the URL to the Network Admin area for the current site with the appropriate protocol, "https" if is_ssl() and "http" otherwise. If scheme is "http" or "https", is_ssl() is overridden.

If the site is not setup as multisite, admin_url() will be used instead.

network_admin_url() 描述

用法

<?php network_admin_url$path$scheme ); ?>

Default Usage

<?php $url network_admin_url(); ?>

network_admin_url() 用法

参数

$path

(string) (可选) Path relative to the admin URL.

默认值: None

$scheme

(string) (可选) 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. The function uses network_site_url(), so allowed values include any accepted by that function.

默认值: 'admin'

network_admin_url() 参数

示例

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */

$url = network_admin_url();
echo $url;

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

(protocol will be https when appropriate)

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */

// 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

network_admin_url() 示例

注意

network_admin_url() 注意

相关