WP_Network::__get() WordPress Method

The WP_Network::__get() method is a magic method that allows direct access to properties of the WP_Network object.

WP_Network::__get( string $key ) #

Getter.


Description

Allows current multisite naming conventions when getting properties.


Top ↑

Parameters

$key

(string)(Required)Property to get.


Top ↑

Return

(mixed) Value of the property. Null if not available.


Top ↑

Source

File: wp-includes/class-wp-network.php

	public function __get( $key ) {
		switch ( $key ) {
			case 'id':
				return (int) $this->id;
			case 'blog_id':
				return (string) $this->get_main_site_id();
			case 'site_id':
				return $this->get_main_site_id();
		}

		return null;
	}


Top ↑

Changelog

Changelog
VersionDescription
4.6.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.