Summery Summery
Retrieves the site URL for the current network.
Syntax Syntax
Description Description
Returns the site URL with the appropriate protocol, ‘https’ if is_ssl() and ‘http’ otherwise. If $scheme is ‘http’ or ‘https’, is_ssl() is overridden.
Parameters Parameters
- $path
-
(Optional) Path relative to the site URL.
Default value: ''
- $scheme
-
(Optional) Scheme to give the site URL context. Accepts 'http', 'https', or 'relative'.
Default value: null
Return Return
(string) Site URL link with optional path appended.
Source Source
File: wp-includes/link-template.php
return apply_filters( 'plugins_url', $url, $path, $plugin );
}
/**
* Retrieves the site URL for the current network.
*
* Returns the site URL with the appropriate protocol, 'https' if
* is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
* overridden.
*
* @since 3.0.0
*
* @see set_url_scheme()
*
* @param string $path Optional. Path relative to the site URL. Default empty.
* @param string $scheme Optional. Scheme to give the site URL context. Accepts
* 'http', 'https', or 'relative'. Default null.
* @return string Site URL link with optional path appended.
*/
function network_site_url( $path = '', $scheme = null ) {
if ( ! is_multisite() ) {
return site_url( $path, $scheme );
}
$current_network = get_network();
if ( 'relative' === $scheme ) {
$url = $current_network->path;
} else {
$url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |