First of all I want to thank all of your for reading my post and trying to answer my question. I'm having an issue regarding the taxonomies of Wordpress.

I created a website with a custom taxonomy and placed them in the backend in Hierarchy. The goal for me is to display al the taxonomies in hierarchical way on my wordpress site. For now i managed to echo the list on alphabetical order.

Are there guys around who can help me with creating a Hierarchical way of showing the taxonomies?

My code:

<?php $terms = get_terms( 'locations', array( 'hide_empty' => false ) ); ?>
                <?php if ( ! empty( $terms ) ) : ?>
                    <div class="col-sm-7">
                        <div class="module">
                            <div class="module-content">
                                <h4><Bekijk een wijnland</h4>
                                <div class="row">                                   
                                    <ul class="not-found-links">
                                        <?php foreach ( $terms as $term ): ?>
                                            <li class="col-sm-4">
                                                <a href="<?php echo get_term_link( $term, 'locations' ); ?>"><?php echo esc_html( $term->name ); ?></a>
                                        <?php endforeach; ?>
                                </div><!-- /.row -->        
                            </div><!-- /.module-content -->             
                        </div><!-- /.module -->
                    </div><!-- /.col-* -->
                <?php endif; ?>
            </div><!-- /.row -->
        </div><!-- /.not-found-content -->
</div><!-- /.content -->

I placed the taxonomies in a table. See: http://winelisting.nl/wijnlanden/.

Many thanks in advance.

Kind regards,


1 Answer 1


You can use wp_list_categories() and pass in your custom taxonomy as an argument like so:

$args = array(
    'taxonomy'     => 'locations',
    'orderby'      => 'name',
    'hide_empty'   => false,
    'show_count'   => false,
    'pad_counts'   => false,
    'hierarchical' => true,
    'title_li'     => ''

    <?php wp_list_categories( $args ); ?>



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.