site_url
云策文档标注
概述
site_url 是一个 WordPress 过滤器,用于修改站点 URL。它允许开发者拦截和调整站点 URL 的生成,包括路径、协议和站点 ID 等参数。
关键要点
- 过滤器名称:site_url
- 参数:$url(完整站点 URL)、$path(相对路径)、$scheme(协议,如 'http'、'https' 等)、$blog_id(站点 ID)
- 返回:应用过滤器后的 URL
- 相关函数:get_site_url() 用于获取站点 URL,wp_is_site_url_using_https() 用于检查站点 URL 是否使用 HTTPS
- 引入版本:WordPress 2.7.0
原文内容
Filters the site URL.
Parameters
$urlstring-
The complete site URL including scheme and path.
$pathstring-
Path relative to the site URL. Blank string if no path is specified.
$schemestring|null-
Scheme to give the site URL context. Accepts
'http','https','login','login_post','admin','relative'or null. $blog_idint|null-
Site ID, or null for the current site.
Source
return apply_filters( 'site_url', $url, $path, $scheme, $blog_id );
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |