$categories = get_categories( array(
'exclude_tree' => array(40)
));
In both get_categories()
and wp_list_categories()
you can use the exclude_tree
parameter instead of exclude
.
- exclude_tree
(array|string) Array or comma/space-separated string of term ids to exclude along with all of their descendant terms. If $include is non-empty, $exclude_tree is ignored.
Default empty array.