You’ll probably have to run a cycle using get_terms() paired with the ‘parent’ attribute.
$args = array( 'parent' => 0 );
$parents = get_terms( array( 'custom-tax' ), $args );
foreach ( $parents as $parent ) {
echo $parent->name;
$args['parent'] = $parent->term_id;
if ( $children = get_terms( array( 'custom-tax' ), $args ) ) {
foreach ( $children as $child ) {
echo $child->name;
}
}
}
You may be able to rewrite the “if ( $children…” into a while loop if you need more recursion than that.