Have you tried
wp_list_categories( array('depth'=>2,'title_li'=>null));
This outputs the categories as a list, with their children as a nested list. The categories are linked to their respective page.
Related Posts:
- WP REST API: filter by category 1 AND category 2
- Display All Products by Category with WooCommerce
- Get only the top level categories using get_categories() without foreach loop
- get_terms vs. get_categories: does it matter?
- What is a good robots.txt?
- Add a URL prefix to permalinks of one category of posts only
- Woocommerce get category image full size
- Fixing category count
- Can a Child Category Have More than One Parent?
- Rewrite URL with category and tag combined using WP_Rewrite
- Add forward slash on categories url (serve one version of a url)
- Elegant way to add parent categories?
- Alphabetical Index Page
- adding custom fields to next and previous post link
- Categories Listing with “selected” category highlighted
- Update term count using a callback function
- Assign parent category to all posts that are already assigned to child category
- Using same slug name for a page and category
- Related content based on category name
- If no posts in category display Form instead of not found
- programmatically adding categories to custom taxonomy
- Getting WordPress custom taxonomy/category?
- How to run WP_Query to retrieve attachments to posts only from a particular category?
- Migrate posts into a different category
- How to get post category title within the loop?
- If category is in parent category?
- Hide posts of a certain category unless logged in
- WP_Query() returns null when results exist!
- Problem displaying one post from each category
- How to filter out Categories for specific post types on WordPress Admin?
- Limit a meta box to a specific category
- get_posts and multiple categories
- How do I get rid of “category” from my URL structure?
- List categories with posts
- Pagination not visible on woocommerce’s category page
- Only one post is showing on category page, why?
- wp_list_categories set order manually?
- Refine/Filter the Search Results by Category
- Putting a Category of posts under a Page
- change recent posts based on category
- category pagination got broken suddenly
- Where and when does WordPress invoke routes
- Getting category URL with hyphens, not spaces
- How can I change the tooltip in the_category?
- Category.php loads first before page.php?
- wp_update_post is not updating category
- Shortcode interpreted as text
- Output category color option to each li item
- How do I display only two categories Instead of displaying all categories
- Hooking to walker_nav_menu_start_el to insert list of subpages
- scaleability of tags
- Show the latest post from child category?
- Having problems with paging
- How do I add a tag slug to a category URL to filter posts?
- Dropdown menu for subcategories
- How to add categories on a page [duplicate]
- Template hierarchy: how to let category.php conditionally-load archive.php?
- Adding custom ID field to the categories
- Getting Category Children
- Child Category Conditional Question
- Getting the first parent of a hierarchical term
- Break down output of wp_list_categories
- Get the ID of the current post’s child category
- get category name in admin screen
- Return category posts with WP_Query
- Include either name or slug in the include parameter using wp_list_categories?
- get cat id is not working from custom taxonomy
- How to add image for all posts associated to specified category?
- Show the current post’s category, without displaying parent category
- Include specific category in URL automatically
- WordPress Category Page Layout
- get_the_category – display only a single category for a post (not all categories)
- display category with background color
- WooCommerce Product category can be shown with multiple related URLs
- It is possible to display related posts from same category as the current post?
- Categories are not available AT ALL under Menus
- change image on single product page with js
- How to get all post categories without custom post type categories?
- Create categories manually in database
- Displaying a Category on a WordPress Page
- Hide specific category link from showing
- Display Category yearly wise in wp
- Get all subcategories IDs from categorie or categorieIDs
- Redirect category archives to pages
- How to create a category loop on my blog (ACF Plugin)
- Using heirarchial tags or Custom taxonomies
- Get posts base on category ratio of more then two categories
- Images appear in the header on all pages, but not category.php
- How can I add HTML classes for current taxonomy/term hierarchy into my pages to simplify styles?
- Change single.php template based on parent category
- WordPress and “pretty permalink”
- Display List of Categories Within a Custom Taxonomy
- New Category – custom taxonomy
- add custom option to get_categories dropdown
- Category as subdomain
- Categories as selectable links on submission form
- Displaying categories and subcategories without link
- Replace the post count on wp_list_categories with “Has Posts” instead of number and “No Posts” if none
- exclude category in loop.php
- How can I implement pagination on custom category page?