Wordpress
Get custom categories with a hierarchy on the custom post type can be done in the following way:
<?php
global $post;
$taxonomy = 'ваша таксономия';
$terms = wp_get_post_terms( $post->ID, $taxonomy, array( "fields" => "ids" ) );
if( $terms ) {
echo '<ul class="list">';
$terms = trim( implode( ',', (array) $terms ), ' ,' );
wp_list_categories( 'title_li=&taxonomy=' . $taxonomy . '&include=' . $terms );
echo '</ul>';
}
?>Source: https://clicknathan.com/web-design/hierarchical-custom-taxonomy-terms-unordered-list/
