WP_Site::__isset()publicWP 4.6.0

Isset-er.

Allows current multisite naming conventions when checking for properties. Checks for extended site properties.

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

Хуков нет.

Возвращает

true|false. Whether the property is set.

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

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

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

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

Код WP_Site::__isset() WP 6.4.3

public function __isset( $key ) {
	switch ( $key ) {
		case 'id':
		case 'network_id':
			return true;
		case 'blogname':
		case 'siteurl':
		case 'post_count':
		case 'home':
			if ( ! did_action( 'ms_loaded' ) ) {
				return false;
			}
			return true;
		default: // Custom properties added by 'site_details' filter.
			if ( ! did_action( 'ms_loaded' ) ) {
				return false;
			}

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

	return false;
}