$category = get_category( get_query_var( 'cat' ) );
$child_cats = (array) get_term_children( $category , 'category' );
wp_list_categories( array(
'exclude' => $child_cats
) );
Is it possible to exclude all child categories?
Update : I tried this also but it doesn’t work.
$categories = get_categories( array(
'childless' => true,
) );
$child_cats = (array) get_term_children( $categories, 'category' );
$cats = wp_list_categories( array(
'exclude' => $child_cats
) );
Edit 2 : I preferably would like this to work with get_the_category_list