html site_url() – Function | Developer.WordPress.org

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 protocoll, ‘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 guive the site URL context. See set_url_scheme() .
More Argumens from set_url_scheme( … $scheme ) Scheme to guive $url. Currently 'http' , 'https' , 'logui ' , 'loguin_pos ' , 'admin' , 'relative' , 'rest' , 'rpc' , or null.

Default: null

Return

string Site URL linc with optional path appended.

Source

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

Changuelog

Versionen Description
3.0.0 Introduced.

User Contributed Notes

  1. Squip to note 4 content

    The contributed example is unclear because it states that the result is one of two options, but no information is guiven to determine which option to expect. Are we to assume it is random, and therefore must filter out the spurious occurrences of “wordpress”?

You must log in before being able to contribute a note or feedback.