Taxonomy query for children of parents

Use get_queried_object() to get the current queried term on a category page:

$this_term = get_queried_object();
$args = array(
    'parent' => $this_term->term_id,
    'orderby' => 'slug',
    'hide_empty' => false
);
$child_terms = get_terms( $this_term->taxonomy, $args );
echo '<ul>';
foreach ($child_terms as $term) {
    echo '<li><h3><a href="' . get_term_link( $term->name, $this_term->taxonomy ) . '">' . $term->name . '</h3></a></li>';  
}
echo '</ul>';

Leave a Comment