I set up a page with a custom wp_query to call a category of a custom post type.
The query works fine, and only shows the number of post in the posts_per_page argument, but when I add pagenavi(), the pagination function doesn’t work at all. Am I doing something wrong?
Here is my query:
// WP_Query arguments
$args = array(
'post_type' => array( 'item-archive' ),
'nopaging' => false,
'posts_per_page' => '5',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'terms' => 'newsletter-manitoba',
'field' => 'slug',
), ),
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post(); ?>
And then after the page content section:
<?php
pagenavi();
// Restore original Post Data
wp_reset_postdata();
?>