Showing categories and subcategories with posts
Update: Complete code <ul> <?php $get_parent_cats = array( ‘parent’ => ‘0’ //get top level categories only ); $all_categories = get_categories( $get_parent_cats );//get parent categories foreach( $all_categories as $single_category ){ //for each category, get the ID $catID = $single_category->cat_ID; echo ‘<li><a href=”https://wordpress.stackexchange.com/questions/270176/” . get_category_link( $catID ) . “https://wordpress.stackexchange.com/questions/270176/”>’ . $single_category->name . ‘</a>’; //category name & link … Read more