home_url
云策文档标注
概述
home_url 是一个 WordPress 过滤器,用于修改主页 URL。它允许开发者通过参数调整 URL 的路径、方案和站点 ID。
关键要点
- 过滤器名称:home_url
- 参数包括:$url(完整主页 URL)、$path(相对路径)、$orig_scheme(方案类型)、$blog_id(站点 ID)
- 返回值为应用过滤器后的 URL
- 相关函数:get_home_url() 用于获取可访问前端的主页 URL
代码示例
return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );
原文内容
Filters the home URL.
Parameters
$urlstring-
The complete home URL including scheme and path.
$pathstring-
Path relative to the home URL. Blank string if no path is specified.
$orig_schemestring|null-
Scheme to give the home URL context. Accepts
'http','https','relative','rest', or null. $blog_idint|null-
Site ID, or null for the current site.
Source
return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |