Get and loop posts with all taxonomy terms
I created a page that displays the posts orderby comment_count. I have a custom taxonomy named 'authors'.
I would like to display only the posts with taxonomy values. Not a specific term but simply IF the post HAS A TERM from 'authors' then display that post.
Do you think it's possible? Here's my code:
<?php $args = array ( 'orderby' => 'comment_count', 'posts_per_page' => -1, ); ?> <?php $popular = new WP_Query($args); ?> <?php while ($popular->have_posts()) : $popular->the_post(); ?> <article class="item-list item-list-custom <?php echo'item_'.$count; ?>"> <h2 class="post-title"> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a> </h2> </article> <?php endwhile; ?>
I need something like:
$args = array( 'posts_per_page' => 10, 'orderby' => 'comment_count', 'tax_query' => array( array( 'taxonomy' => 'authors', 'field' => 'slug', 'terms' => ALL THE TERMS ), ) );
I hope everything's clear.. sorry for my english :)