404 error next-page [2] PageNavi custom type taxonomy

I have a custom post type called pizza with a custom taxonomy called genero.

mypage/pizza/peperoni/

When i click subsequent paginated page links (e.g. [2], [3], [next])

mypage/pizza/peperoni/page/2

The post is displayed correctly, but when I try to go to next-page [2], takes me to an 404 page

my loop

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 2; 
    $args = array(
      'posts_per_page' => 2,
        'order' => 'DESC',
        'tax_query' => array(
            array(
                'taxonomy' => 'genero',
                'field' => 'slug',
                'terms' => 'peperoni',
                 'paged' => $paged,
            )
        )
    );
    $query = new WP_Query( $args );
    if ( $query->have_posts() ) {
        while ( $query->have_posts() ) {
            $query->the_post();?>

   <?php the_title(); ?>
   <?php                       
    }
    }
    wp_pagenavi( array( 'query' => $query ) );
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

Read more here: 404 error next-page [2] PageNavi custom type taxonomy

Leave a Reply

Your email address will not be published. Required fields are marked *