home_url

Sponsored Link

home_urlテンプレートタグは、現在のサイトのホームURLを取得します。
‘https’は、is_ssl() と ‘http’のそれ以外の場合、適切なプロトコルと共に’home’オプションを返します。schemeが’http’ か ‘https’の場合、is_ssl()は、オーバーライドします。

サイト指定のURLを取得するget_home_url タグを使用します。

Sponsored Link

The home_url template tag retrieves the home url for the current 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.

Use the get_home_url tag to retrieve the url of the site specified.

home_urlのテンプレートタグ使用方法

<?php home_url( 'path', 'scheme' ); ?>

デフォルトの使い方

<?php home_url(); ?>

home_urlのパラメーター

path

(string) (optional)ホームURLのための相対パスです。

(string) (optional) Path relative to the home url.

Default: None

scheme

(string) (optional) ホームURLのコンテキストを提供するスキームです。現在の’http’,’https’です。

(string) (optional) Scheme to give the home url context. Currently ‘http’,’https’.

Default: null

戻り値

(string) オプションのパスが付加されたホームのURLリンクです。

(string) Home url link with optional path appended.

変更ログ

  • 3.0.0 : New template tag.

ソースファイル

home_url()は、wp-includes/link-template.php内に位置しています。

home_url() is located in wp-includes/link-template.php (the development version)

Sponsored Link