I've made a basic subcategory nav menu using the code below.
The problem is on one category (with NO children), it returns the Top Level categories as children, e.g.: News, Uncategorized, etc. (I've tried assigning a child category and it actually disappears from the menu instead of fixing things)
What could be causing this?
function display_category_breadcrumbs () {
$current_cat_id = get_cat_id( single_cat_title("",false) );
$parent_cats = get_categories('parent='.$current_cat_id);
?> <ul id="cat-breadcrumb"> <?php
foreach ($parent_cats as $sub_category ) {
echo '<li><a href="'. esc_url( get_category_link( $sub_category->term_id) ) . '">' . esc_html( $sub_category->cat_name) . '</a></li>';
}
?> </ul> <?php
}