WordPress at a glance

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.

Works based on: get_home_url()
✈ 1 time = 0.000047s = very fast | 50000 times = 0.51s = very fast PHP 7.1.2, WP 4.7.3

No Hooks.

Return

String. Home URL link with optional path appended.

Usage

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

Code of home_url: wp-includes/link-template.php VER 4.9.8

<?php
function home_url( $path = '', $scheme = null ) {
	return get_home_url( null, $path, $scheme );
}

Related Functions

From tag: Link (URL)

More from category: Site Options (settings)

More from Template Tags: Links (URL)

No comments
    Hello, !     Log In . Register