Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_get_site_by_path

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
330       * @since 3.9.0
331       *
332       * @param null|bool|object $site     Site value to return by path.
333       * @param string           $domain   The requested domain.
334       * @param string           $path     The requested path, in full.
335       * @param int|null         $segments The suggested number of paths to consult.
336       *                                   Default null, meaning the entire path was to be consulted.
337       * @param array            $paths    The paths to search for, based on $path and $segments.
338       */
339      $pre = apply_filters( 'pre_get_site_by_path', null, $domain, $path, $segments, $paths );
340      if ( null !== $pre ) {
341           return $pre;
342      }
344      /*
345       * @todo
346       * get_blog_details(), caching, etc. Consider alternative optimization routes,
347       * perhaps as an opt-in for plugins, rather than using the pre_* filter.
348       * For example: The segments filter can expand or ignore paths.