site_url filter-hookWP 2.7.0

Filters the site URL.

Usage

add_filter( 'site_url', 'wp_kama_site_url_filter', 10, 4 );

/**
 * Function for `site_url` filter-hook.
 * 
 * @param string      $url     The complete site URL including scheme and path.
 * @param string      $path    Path relative to the site URL. Blank string if no path is specified.
 * @param string|null $scheme  Scheme to give the site URL context. Accepts 'http', 'https', 'login', 'login_post', 'admin', 'relative' or null.
 * @param int|null    $blog_id Site ID, or null for the current site.
 *
 * @return string
 */
function wp_kama_site_url_filter( $url, $path, $scheme, $blog_id ){

	// filter...
	return $url;
}
$url(string)
The complete site URL including scheme and path.
$path(string)
Path relative to the site URL. Blank string if no path is specified.
$scheme(string|null)
Scheme to give the site URL context. Accepts 'http', 'https', 'login', 'login_post', 'admin', 'relative' or null.
$blog_id(int|null)
Site ID, or null for the current site.

Changelog

Since 2.7.0 Introduced.

Where the hook is called

get_site_url()
site_url
wp_is_site_url_using_https()
site_url
wp-includes/link-template.php 3405
return apply_filters( 'site_url', $url, $path, $scheme, $blog_id );
wp-includes/https-detection.php 56
$site_url = apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null );

Where the hook is used in WordPress

Usage not found.