I want to list only certain categories and exclude a particular parent and all its children. The reason is so that if a new child category is added, it won't show up by default. With wp_list_categories you also get an active class but with get_categories you don't. I would also like to somehow get an active class from it if possible.
I tried this:
$categories = get_categories(array(
'exclude' => array(40)
));
But it still shows the children of category with ID 40.
The below code hides all the children but is a pain to try and style it whereas if I run my own loop with get_categories I can style the output much easier.
<?php wp_list_categories( array(
'orderby' => 'name',
'show_count' => false,
'exclude' => array( 40 )
) ); ?>