WordPress custom taxonomy only shows 1 post

I have a few posts in custom taxonomy. But when I loop the query I get only one post to show.

Here’s the code:

Read More
<?php
$args = array(
    'post_type' => 'songs',
    'posts_per_page' => -1, 
    'tax_query' => array(
        array(
            'taxonomy' => 'genre',
            'field' => 'slug',
            'terms' => 'jazz',
        ),
    ),
    'orderby' => 'menu_order',
    'order' => 'DESC',
);
$query = new WP_Query($args);
if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>
    <div class="contact-item col-lg-4 col-md-4 col-sm-6 col-xs-12">
        <div class="holder">
            <div class="contact-title">
                <h3><?php echo get_the_title(); ?></h3>
            </div>
        </div>
     </div>

What could be wrong?

Related posts

1 comment

  1. The problem might be in the following code ,

    'tax_query' => array(
            array(
                'taxonomy' => 'genre',
                'field' => 'slug',
                'terms' => 'jazz',
            ),
        ),
        'orderby' => 'menu_order',
    

    Please remove this code and check if it works. If works then you need to do something with the suggested code.

Comments are closed.