get_home_url()
get_home_url( int $blog_id = null, string $path = ”, string|null $scheme = null )
检索前端可访问的给定网站的URL。
Retrieves the URL for a given site where the front end is accessible.
说明(Description)
返回具有相应协议的“home”选项。如果is ssl()的计算结果为true,则协议将为“https”;否则,它将与“home”选项相同。如果$scheme是’http’或’https’,is_ssl()将被重写。
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$blog_id | (int) | 可选 | 站点ID。默认为空(当前站点)。 |
$path | (string) | 可选 | 相对于主URL的路径。 |
$scheme | (string | null) | 可选 | 提供主URL上下文的方案。接受“http”、“https”、“relative”、“rest”或null。 |
返回(Return)
(string)附加了可选路径的主URL链接。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
3.0.0 | wp-includes/link-template.php:3172 | 16 | 9 |
get_home_url() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_home_url/