site_by_path_segments_count

Filters the number of path segments to consider when searching for a site.

Description

apply_filters( 'site_by_path_segments_count', (int|null) $segments, (string) $domain, (string) $path ); 

Parameters (3)

0. $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.
1. $domain (string)
The requested domain.
2. $path (string)
The requested path, in full.

Usage

To run the hook, copy the example below.
  1. $segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path ); 
  2.  
  3. if ( !empty( $segments ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the site_by_path_segments_count callback 
  2. function filter_site_by_path_segments_count( $segments, $domain, $path ) { 
  3. // make filter magic happen here... 
  4. return $segments
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'site_by_path_segments_count', 'filter_site_by_path_segments_count', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'site_by_path_segments_count', 'filter_site_by_path_segments_count', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/ms-load.php  
  1. $segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path );