site_by_path_segments_count
Filter HookDescription
Filters the number of path segments to consider when searching for a site.Hook Information
File Location |
wp-includes/ms-load.php
View on GitHub
|
Hook Type | Filter |
Line Number | 177 |
Hook Parameters
Type | Name | Description |
---|---|---|
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. |
string
|
$domain
|
The requested domain. |
string
|
$path
|
The requested path, in full. |
Usage Examples
Basic Usage
<?php
// Hook into site_by_path_segments_count
add_filter('site_by_path_segments_count', 'my_custom_filter', 10, 3);
function my_custom_filter($segments, $domain, $path) {
// Your custom filtering logic here
return $segments;
}
Source Code Context
wp-includes/ms-load.php:177
- How this hook is used in WordPress core
<?php
172 * one path segment following the network path. The function default of
173 * null only makes sense when you know the requested path should match a site.
174 * @param string $domain The requested domain.
175 * @param string $path The requested path, in full.
176 */
177 $segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path );
178
179 if ( null !== $segments && count( $path_segments ) > $segments ) {
180 $path_segments = array_slice( $path_segments, 0, $segments );
181 }
182
PHP Documentation
<?php
/**
* Filters the number of path segments to consider when searching for a site.
*
* @since 3.9.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/ms-load.php
Related Hooks
Related hooks will be displayed here in future updates.