WordPress at a glance
function is not described

_get_term_hierarchy() WP 2.3.0

Retrieves children of taxonomy as Term IDs.

No Hooks.

Return

Array. Empty if $taxonomy isn't hierarchical or returns children as Term IDs.

Usage

_get_term_hierarchy( $taxonomy );
$taxonomy(string) (required)
Taxonomy name.

Code of get term hierarchy: wp-includes/taxonomy.php VER 5.0.3

<?php
function _get_term_hierarchy( $taxonomy ) {
	if ( !is_taxonomy_hierarchical($taxonomy) )
		return array();
	$children = get_option("{$taxonomy}_children");

	if ( is_array($children) )
		return $children;
	$children = array();
	$terms = get_terms($taxonomy, array('get' => 'all', 'orderby' => 'id', 'fields' => 'id=>parent'));
	foreach ( $terms as $term_id => $parent ) {
		if ( $parent > 0 )
			$children[$parent][] = $term_id;
	}
	update_option("{$taxonomy}_children", $children);

	return $children;
}