network_by_path_segments_count
云策文档标注
概述
本文档介绍 WordPress 中的 network_by_path_segments_count 过滤器,用于在搜索站点时控制考虑的路经段数量。默认情况下,WordPress 仅查看一个路径段,此过滤器允许开发者调整此行为。
关键要点
- network_by_path_segments_count 是一个过滤器,用于修改在查找网络时考虑的路径段数量。
- 参数包括 $segments(路径段数量,可为 null)、$domain(请求的域名)和 $path(完整请求路径)。
- 此过滤器在 WP_Network::get_by_path() 函数中使用,用于检索与域名和路径最匹配的网络。
- WordPress 3.9.0 版本引入此过滤器。
代码示例
$segments = apply_filters( 'network_by_path_segments_count', $segments, $domain, $path );
原文内容
Filters the number of path segments to consider when searching for a site.
Parameters
$segmentsint|null-
The number of path segments to consider. WordPress by default looks at one path segment. The function default of null only makes sense when you know the requested path should match a network.
$domainstring-
The requested domain.
$pathstring-
The requested path, in full.
Source
$segments = apply_filters( 'network_by_path_segments_count', $segments, $domain, $path );
Changelog
| Version | Description |
|---|---|
| 3.9.0 | Introduced. |