get_network_by_path() WordPress Function

The get_network_by_path() function allows you to get a network object by its path. This is useful for finding a network by its domain or subdomain.

get_network_by_path( string $domain, string $path, int|null $segments = null ) #

Retrieves the closest matching network for a domain and path.


Parameters

$domain

(string)(Required)Domain to check.

$path

(string)(Required)Path to check.

$segments

(int|null)(Optional)Path segments to use. Defaults to null, or the full path.

Default value: null


Top ↑

Return

(WP_Network|false) Network object if successful. False when no network is found.


Top ↑

Source

File: wp-includes/ms-load.php

function get_network_by_path( $domain, $path, $segments = null ) {
	return WP_Network::get_by_path( $domain, $path, $segments );
}


Top ↑

Changelog

Changelog
VersionDescription
3.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.