Use wp_list_categories()
instead, which handles the display and ordering of hierarchical terms.
Despite its name suggesting that it’s just for categories, it works with custom taxonomies too:
$taxonomy_args = array(
'public' => true,
'_builtin' => false,
);
$output="names";
$operator="and";
$taxonomies = get_taxonomies( $taxonomy_args, $output, $operator );
if ( $taxonomies ) {
foreach ( $taxonomies as $taxonomy ) {
echo '<ul>';
wp_list_categories( array (
'order' => 'ASC',
'orderby' => 'name',
'title_li' => '',
'taxonomy' => $taxonomy,
'show_option_none' => '',
) );
echo '</ul>';
}
}