How can I show a list of child categories on parent a category page?

First you need to current viewing category id and taxonomy name. For that you need to call get_queried_object() this function like below:

$term = get_queried_object();

Then you need to call the get_terms() function to get child categories like below: ( if you don’t want to show those categories which not belong any post then set ‘hide_empty’ => true )

$child_categories = get_terms( $term->taxonomy, array(
	'parent'    => $term->term_id,
	'hide_empty' => false
) );

if ( !empty( $child_categories ) ) { 
	foreach( $child_categories as $c_cat ) {
		echo '<li><a href="' . esc_url( get_term_link( $c_cat, $c_cat->taxonomy ) ) . '">' . $c_cat->name . '</a></li>';
	}
}

Leave a Reply

Your email address will not be published. Required fields are marked *