Page navi is not working in custom taxonomy template?

I have a custom taxonomy template taxonomy-event-category.php and i
have added following code for pagination but it does not work.

<?php
$current_term = single_term_title("", false);
$cat_id = get_cat_ID('My Category');
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;

$args=array(
    'post_type' => 'event',
    'post_status' => 'publish',
    'posts_per_page' => 1,
    'paged'=>$paged,

    'caller_get_posts'=> 1,
    'tax_query' => array(
        array(
            'taxonomy' => 'event-categories',
            'field'    => 'slug',
            'terms'    => $current_term,

        ),
    ),
);
$new = new WP_Query($args);

while( $new->have_posts() ):  $new->the_post();

    /* OUTPUT HERE */
endwhile;

if ( function_exists( 'wp_pagenavi' ) ) {
    wp_pagenavi( array( 'query' => $new ) );

}

wp_reset_postdata();
?>

whenever i click on the next page or second page getting me 404
page not found error.

Read More

Anyone have idea about how pagnavi work in custom taxonomy template.

Related posts

Leave a Reply