Use get_the_terms to list subcategories of custom taxonomy
When you use get_the_terms() it returns a term object. One of the fields is ‘parent’ which stores the ID of the term parent. So you can compare the current term’s parent to the parent term that you are looking for. $desired_parent_name=”fruits”; $desired_parent_id = get_term_by(‘name’, $desired_parent_name)->term_id; foreach ($terms as $term) { if $term->parent == $desired_parent_id { … Read more