Olá pessoal. Criei essa função para exibir as categorias filhas dinâmicamente:
<?php
$term_id = get_queried_object()->term_id;
$taxonomy_name = 'question_category';
$termchildren = get_term_children( $term_id, $taxonomy_name );
echo '<ul>';
foreach ( $termchildren as $child ) {
$term = get_term_by( 'id', $child, $taxonomy_name );
echo '<li><a href="' . get_term_link( $child, $taxonomy_name ) . '">' . $term->name . '</a></li>';
}
echo '</ul>';
?>
Agora preciso exibir dinamicamente a categoria pai. Como posso fazer utilizando este mesmo código?