ACF\AI\GEO
Schema::get_type_parents
Get all parent types for a given type
Method of the class: Schema{}
No Hooks.
Returns
Array. Array of parent type names in order from direct parent to root
Usage
$result = Schema::get_type_parents( $type );
- $type(string) (required)
- The schema.org type name.
Changelog
| Since 6.8.0 | Introduced. |
Schema::get_type_parents() Schema::get type parents code ACF 6.8.8
private static function get_type_parents( $type ) {
$parents = array();
$current = $type;
$type_hierarchy = SchemaData::get_type_hierarchy();
while ( isset( $type_hierarchy[ $current ] ) ) {
$parent = $type_hierarchy[ $current ];
$parents[] = $parent;
$current = $parent;
}
return $parents;
}