WP_Network
- Since
- 4.4.0
- Source
wp-includes/class-wp-network.php:27
Core class used for interacting with a multisite network.
Description
This class is used during load to populate the $current_site global and setup the current network.
This class is most useful in WordPress multi-network installations where the ability to interact with any network of sites is required.
Compatibility
- WordPress
- since 4.4.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 3
Every hook that fires from inside WP_Network, in the order it appears in the class, grouped by the method that fires it.
WP_Network::get_by_path()
- apply_filters( network_by_path_segments_count )filter line 387
- apply_filters( pre_get_network_by_path )filter line 421
Properties · 6
$idintprivate- Network ID.
$domainstringpublic- Domain of the network.
$pathstringpublic- Path of the network.
$blog_idstringprivate- The ID of the network's main site.
$cookie_domainstringpublic- Domain used to set cookies for this network.
$site_namestringpublic- Name of this network.
Methods · 9
- get_instance()Retrieves a network from the database by its ID.
- __construct()Creates a new WP_Network object.
- __get()Getter.
- __isset()Isset-er.
- __set()Setter.
- get_main_site_id()Returns the main site ID for the network.
- _set_site_name()Sets the site name assigned to the network if one has not been populated.
- _set_cookie_domain()Sets the cookie domain based on the network domain if one has not been populated.
- get_by_path()Retrieves the closest matching network for a domain and path.
Changelog
Introduced in 4.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/class-wp-network.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.