site_by_path_segments_count
Filters the number of path segments to consider when searching for a site.
Usage
add_filter( 'site_by_path_segments_count', 'wp_kama_site_by_path_segments_count_filter', 10, 3 ); /** * Function for `site_by_path_segments_count` filter-hook. * * @param int|null $segments The number of path segments to consider. WordPress by default looks at one path segment following the network path. The function default of null only makes sense when you know the requested path should match a site. * @param string $domain The requested domain. * @param string $path The requested path, in full. * * @return int|null */ function wp_kama_site_by_path_segments_count_filter( $segments, $domain, $path ){ // filter... return $segments; }
- $segments(int|null)
- The number of path segments to consider. WordPress by default looks at one path segment following the network path. The function default of null only makes sense when you know the requested path should match a site.
- $domain(string)
- The requested domain.
- $path(string)
- The requested path, in full.
Changelog
Since 3.9.0 | Introduced. |
Where the hook is called
site_by_path_segments_count
wp-includes/ms-load.php 177
$segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path );