site_url
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
site_url
site_url
wp-includes/link-template.php 3528
return apply_filters( 'site_url', $url, $path, $scheme, $blog_id );
wp-includes/https-detection.php 58
$site_url = apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null );