get_site_by_path()
get_site_by_path( string $domain, string $path, int|nul…
get_site_by_path( string $domain, string $path, int|null $segments = null )
按域和路径检索最接近的匹配站点对象。
Retrieves the closest matching site object by its domain and path.
按域和路径检索最接近的匹配站点对象。
Retrieves the closest matching site object by its domain and path.
目录锚点:#说明#参数#返回#源码
说明(Description)
这不一定会返回与域和路径完全匹配的结果。相反,它将域和路径分割成多个片段,然后用于匹配查询中最接近的可能性。
此方法的目的是在引导期间为请求的站点地址匹配站点对象
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $domain | (string) | 必需 | 要检查的域。 |
| $path | (string) | 必需 | 检查路径。 |
| $segments | (int | null) | 可选 | 要使用的路径段。默认为空或完整路径。 |
返回(Return)
(WP|Site|false)如果成功,则为站点对象。如果找不到站点,则为False。
源码(Source)
| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 4.7.0 | wp-includes/ms-load.php:165 | 1 function | 5 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!