WP_Site::__get()publicWP 4.6.0

Getter.

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

Метод класса: WP_Site{}

Хуков нет.

Возвращает

Разное. Value of the property. Null if not available.

Использование

$WP_Site = new WP_Site();
$WP_Site->__get( $key );
$key(строка) (обязательный)
Property to get.

Список изменений

С версии 4.6.0 Введена.

Код WP_Site::__get() WP 6.5.2

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;
}