get_network_by_path

Retrieve the closest matching network for a domain and path.

Description

(WP_Network|false) get_network_by_path( (string) $domain, (string) $path, (null) $segments = null ); 

Returns (WP_Network|false)

Network object if successful. False when no network is found.

Parameters (3)

0. $domain (string)
Domain to check.
1. $path (string)
Path to check.
2. $segments — Optional. (null) => null
Path segments to use. Defaults to null, or the full path.

Usage

  1. if ( !function_exists( 'get_network_by_path' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-load.php'; 
  3.  
  4. // Domain to check. 
  5. $domain = ''; 
  6.  
  7. // Path to check. 
  8. $path = ''; 
  9.  
  10. // Path segments to use. Defaults to null, or the full path. 
  11. $segments = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = get_network_by_path($domain, $path, $segments); 
  15.  

Defined (1)

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

/wp-includes/ms-load.php  
  1. function get_network_by_path( $domain, $path, $segments = null ) { 
  2. return WP_Network::get_by_path( $domain, $path, $segments );