Сделал:
<?php 
$category = get_the_category();
$terms = get_the_terms(get_the_ID(),'category');
$term_ids = wp_list_pluck($terms,'term_id');
$parents = array_filter(wp_list_pluck($terms,'parent'));
$term_ids_not_parents = array_diff($term_ids,  $parents);		
$terms_not_parents = array_intersect_key($terms,  $term_ids_not_parents);
foreach( $terms_not_parents as $category ) { ?>
	<a href="<?php echo get_term_link($category->name, "category") ?>" class="category">			
		<?php echo $category->name; ?>
	</a>
<? } ?>