I am trying to list only the children of a chosen parent category. The following code lists all children. I would like to just be able to change the id or something of the parent to only list children from that selected parent.
<?php
$taxonomy_name = 'download_category';
$queried_object = get_queried_object();
$term_id = $queried_object->term_id;
$termchildren = get_the_terms( $post->ID, $taxonomy_name, array( 'parent' => $term_id, 'hide_empty' => false ) );
echo '<ul>';
foreach ( $termchildren as $child ) {
echo '<li><a href="' . get_term_link( $child, $taxonomy_name ) . '">' . $child->name . '</a></li>';
}
echo '</ul>';
?>
Please if someone can help. Thanks