WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/get home url

Contents

Description

The get_home_url template tag retrieves the home url for a given site. Returns the 'home' option with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If scheme is 'http' or 'https', is_ssl() is overridden.

Usage

<?php get_home_url$blog_id$path$scheme ); ?>

Default Usage

<?php get_home_url(); ?>

Parameters

$blog_id
(integer) (optional) Blog ID.
Default: null (the current blog)
$path
(string) (optional) Path relative to the home url.
Default: None
$scheme
(string) (optional) Scheme to give the home url context. Currently 'http', 'https' and 'relative'.
Default: null

Return

(string) 
Home url link with optional path appended.

Hooks

apply_filters() Calls 'home_url' hook on home url before returning.

Examples

Changelog

Source Code

get_home_url() is located in wp-includes/link-template.php.

Related

Edit Link: edit_post_link(), edit_comment_link(), edit_tag_link(), edit_bookmark_link()

See also index of Function Reference and index of Template Tags.