wordpress / latest / functions / site_url.html

site_url( string $path = '', string|null $scheme = null ): string

Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible.

Description

Returns the ‘site_url’ option with the appropriate protocol, ‘https’ if is_ssl() and ‘http’ otherwise. If $scheme is ‘http’ or ‘https’, is_ssl() is overridden.

Parameters

$path string Optional
Path relative to the site URL.

Default: ''

$scheme string|null Optional
Scheme to give the site URL context. See set_url_scheme() .
More Arguments from set_url_scheme( ... $scheme ) Scheme to give $url. Currently 'http', 'https', 'login', 'login_post', 'admin', 'relative', 'rest', 'rpc', or null.

Default: null

Return

string Site URL link with optional path appended.

Source

File: wp-includes/link-template.php. View all references

function site_url( $path = '', $scheme = null ) {
	return get_site_url( null, $path, $scheme );
}

Uses

Uses Description

Used By

Used By Description

Changelog

Version Description
3.0.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/site_url