My list of terms of custom taxonomy displays 7 times

Question

i’m building a custom page template to show a list of terms from a custom taxonomy named "autore", and i don’t know why it displays the full list more than one time (seven times, to be precise). Anybody can help?

    <?php
/**
 * Template Name: Archive Custom Taxonomy
 */

get_header(); the_post(); ?>

<?php
$args=array(
  'public'   => true,
  '_builtin' => false
);
$output = 'names'; // or objects
$operator = 'and';
$taxonomies=get_taxonomies($args,$output,$operator);
if  ($taxonomies) {
  foreach ($taxonomies  as $taxonomy ) {
    $terms = get_terms([
    'taxonomy' => 'autore',
    'hide_empty' => false,
        'orderby' => 'name',
        'order' => 'ASC',
]);
        foreach ( $terms as $term) {
    echo '<li><a href="'.get_term_link($term).'">'.$term->name.'</a></li>';
}
              }
            }
            ?>

<?php get_footer();
0
Marco Vez 2 months 0 Answers 6 views 0

Leave an answer