wordpress / latest / functions / home_url.html

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

Retrieves the URL for the current site where the front end is accessible.

Description

Returns the ‘home’ option with the appropriate protocol. The protocol will be ‘https’ if is_ssl() evaluates to true; otherwise, it will be the same as the ‘home’ option.
If $scheme is ‘http’ or ‘https’, is_ssl() is overridden.

Parameters

$path string Optional
Path relative to the home URL.

Default: ''

$scheme string|null Optional
Scheme to give the home URL context. Accepts 'http', 'https', 'relative', 'rest', or null.

Default: null

Return

string Home URL link with optional path appended.

Source

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

function home_url( $path = '', $scheme = null ) {
	return get_home_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/home_url