network_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/class-wp-network.php
View on GitHub
|
Hook Type | Filter |
Line Number | 383 |
Hook Parameters
Type | Name | Description |
---|---|---|
int|null
|
$segments
|
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. |
string
|
$domain
|
The requested domain. |
string
|
$path
|
The requested path, in full. |
Usage Examples
Basic Usage
<?php
// Hook into network_by_path_segments_count
add_filter('network_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/class-wp-network.php:383
- How this hook is used in WordPress core
<?php
378 * one path segment. The function default of null only makes sense when you
379 * know the requested path should match a network.
380 * @param string $domain The requested domain.
381 * @param string $path The requested path, in full.
382 */
383 $segments = apply_filters( 'network_by_path_segments_count', $segments, $domain, $path );
384
385 if ( ( null !== $segments ) && count( $path_segments ) > $segments ) {
386 $path_segments = array_slice( $path_segments, 0, $segments );
387 }
388
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. The function default of null only makes sense when you
* know the requested path should match a network.
* @param string $domain The requested domain.
* @param string $path The requested path, in full.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/class-wp-network.php
Related Hooks
Related hooks will be displayed here in future updates.