WordPress at Your Fingertips

home_url() WP 1.0

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

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.

1 time — 0.000047 sec (very fast) | 50000 times — 0.51 sec (very fast) | PHP 7.1.2, WP 4.7.3

No Hooks.


String. Home URL link with optional path appended.


home_url( $path, $scheme );
Path relative to the home URL.
Default: ''
Scheme to give the home URL context. Accepts 'http', 'https', 'relative', 'rest', or null.
Default: null


Since 3.0.0 Introduced.

Code of home_url() WP 5.7.2

function home_url( $path = '', $scheme = null ) {
	return get_home_url( null, $path, $scheme );

From tag: Link (URL)

More from category: Site Options (settings)

More from Template Tags: Links (URL)

No comments
    Log In