parent1 - child1 - grandchild1
I need to show child terms of any current term (only direct child) for each term I visit. Works only for the parent (show child1) but not for the child (doesn't show granchild1)
How I can fix this issue? Thank's
$queried_object = get_queried_object();
$cpt = get_post_type( get_the_ID() );
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
echo 'cpt - '.$cpt;
echo '<br>tax - '.$taxonomy;
echo '<br>term id - '.$term_id;
$customPostTaxonomies = get_object_taxonomies($cpt);
if ( $customPostTaxonomies ) {
foreach($customPostTaxonomies as $tax) {
$args = array(
'orderby' => 'name',
'hierarchical' => 0,
'taxonomy' => $tax,
'field' => 'id',
'parent'=> $term_id,
'title_li' => ''
);
wp_list_categories( $args );
}
UPDATE:
Structure:
cpt = corsi
tax = argomenti
tax_term = parent1
tax_term_child = child1
tax_term_child_granchild = grandchild1