WP_Site::__get( string $key )

Getter.


Description Description

Allows current multisite naming conventions when getting properties. Allows access to extended site properties.


Parameters Parameters

$key

(string) (Required) Property to get.


Top ↑

Return Return

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


Top ↑

Source Source

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

	public function __get( $key ) {
		switch ( $key ) {
			case 'id':
				return (int) $this->blog_id;
			case 'network_id':
				return (int) $this->site_id;
			case 'blogname':
			case 'siteurl':
			case 'post_count':
			case 'home':
			default: // Custom properties added by 'site_details' filter.
				if ( ! did_action( 'ms_loaded' ) ) {
					return null;
				}

				$details = $this->get_details();
				if ( isset( $details->$key ) ) {
					return $details->$key;
				}
		}

		return null;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.