3 Answers
3

Check if $cat->category_parent != 1 (assuming uncategorized has the default ID of 1). If your subcategories are deeper than one level you'll need to use get_ancestors to determine the top level category.