get_home_url

Sponsored Link

get_home_urlテンプレートタグは、特定のサイトのホームURLを取得します。
‘https’の場合は、is_ssl() と’http’のそれ以外の場合、’home’オプションを適切なプロトコルを返します。スキームが’http’ あるいは ‘https’の場合、is_ssl()がオーバーライドします。

Sponsored Link

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.

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

<?php get_home_url( $blog_id, 'path', 'scheme' ); ?>

get_home_urlデフォルトの使い方

<?php get_home_url(); ?>

get_home_urlのパラメーター

blog_id

(integer) (optional) ブログIDです。

(integer) (optional) Blog ID.

Default: null (the current blog)

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.

ハック

apply_filters()は、ホームURLを返す前に、’home_url’ハックを呼び出します。

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

変更ログ

  • 3.0.0 : New template tag.

ソースファイル

get_home_url()は、以下のファイルに位置しています。

get_home_url() is located in

  • wp-includes/link-template.php (the development version)
Sponsored Link