ACF\AI\GEO

Schema::type_has_properties │ public static │ ACF 6.8.0

Check if a Schema.org type has properties defined on it or its ancestors

Walks up the type hierarchy checking if the type or any parent (excluding Thing, which is too generic) has properties defined. This distinguishes structural types (Person, Place, Organization) from value types (Duration, Distance) that have no meaningful sub-properties.

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

Хуков нет.

Возвращает

boolean. True if type or an ancestor has properties defined

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

$result = Schema::type_has_properties( $type );
$type(строка) (обязательный)
The Schema.org type name.

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

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

Код Schema::type_has_properties() ACF 6.8.11

public static function type_has_properties( $type ) {
	$current          = $type;
	$property_domains = SchemaData::get_property_domains();
	$type_hierarchy   = SchemaData::get_type_hierarchy();

	// Walk up the hierarchy, but stop before Thing (too generic).
	while ( $current && 'Thing' !== $current ) {
		foreach ( $property_domains as $domains ) {
			if ( in_array( $current, $domains, true ) ) {
				return true;
			}
		}
		// Move to parent type.
		$current = $type_hierarchy[ $current ] ?? null;
	}

	return false;
}