How to display custom taxonomy parent and child including the posts

I’m currently working on a WordPress-project which has to display all the categories, subcategories and posts within these subcategories of a custom post type & taxonomy.
I should become something like this:

Category 1
subcategory

post 1

post 2

subcategory

post 3

Category 2
subcategory

post 4

At this moment the code returns a list of all the categories and subcategories
in the taxonomy between the h3-tags. Only the parent categories should be displayed here.

Read more here: How to display custom taxonomy parent and child including the posts

Leave a Reply

Your email address will not be published. Required fields are marked *