network_admin_url()

 

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 );
}

参数:network_admin_url( string $path = '', string $scheme = 'admin' )

path relative to the admin URL. The scheme to use. Default is 'admin', which obeys 强制u ssl u admin() and ISSL(). 'http' or 'https' can be passed to force those schemes.

(字符串)附加了可选路径的管理URL链接。

$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'

{acontent3}

  1. 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

You must log in before being able to contribute a note or feedback.

20.00% (2) 次Baidu访问
20.00% (2) 次Google访问
50.00% (5) 次Sogou访问
10.00% (1) 次sm访问
  • 蜘蛛:Baidu,2次,更新时间:2019-04-25 11:43:46
  • 蜘蛛:Google,2次,更新时间:2019-05-14 19:51:41
  • 蜘蛛:Sogou,5次,更新时间:2019-05-05 15:01:40
  • 蜘蛛:sm,1次,更新时间:2019-05-14 21:39:55

参与评论