Home > AI > Backend > Wordpress >

get_terms

Example: get children categories

$terms = get_terms( get_query_var('taxonomy'), 
                                array( 'parent' => get_queried_object()->term_id, 
                                    'orderby' => 'slug',
                                    'hide_empty' => false ) );
foreach ( $terms as $term ) {
    echo '<li><a href="' . get_term_link( $term ) . '">' . $term->name . '</a></li>';   
}

Leave a Reply