Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: network_by_path_segments_count

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
230                 *
231                 * @since 3.9.0
232                 *
233                 * @param int|null $segments The number of path segments to consider. WordPress by default looks at
234                 *                           one path segment. The function default of null only makes sense when you
235                 *                           know the requested path should match a network.
236                 * @param string   $domain   The requested domain.
237                 * @param string   $path     The requested path, in full.
238                 */
239                $segments = apply_filters( 'network_by_path_segments_count', $segments, $domain, $path );
240
241                if ( ( null !== $segments ) && count( $path_segments ) > $segments ) {
242                     $path_segments = array_slice( $path_segments, 0, $segments );
243                }
244
245                while ( count( $path_segments ) ) {
246                     $paths[] = '/' . implode( '/', $path_segments ) . '/';
247                     array_pop( $path_segments );
248                }