Get Bottom Most Level Taxonomy Terms?
Here is the solution I ended up with. This may help others too. $taxonomy = “product-category”; $args = array( ‘taxonomy’ => $taxonomy, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hierarchical’ => true, ‘hide_empty’ => false, ); $the_query = new WP_Term_Query($args); $categories = $the_query->get_terms(); if ($categories){ foreach($categories as $category){ $ancestors = get_ancestors( $category->term_id, $taxonomy ); $category->ancestors = … Read more