get taxonomy terms for parent and child
You should have two foreach loops. One for getting parent taxonomy terms, and second for getting child taxonomy terms. In the second foreach you need to specify the parent taxonomy term ID which is $parent_term->term_id from the first foreach loop. foreach( get_terms( ‘products-category’, array( ‘hide_empty’ => false, ‘parent’ => 0 ) ) as $parent_term ) … Read more