My pagenavi setup is bugging in a WP_query on single posts. I found many possible solutions but none worked for me. Also I realise it is probably more related to wp itself but hopefully someone can see what I am doing wrong here.
- Pagenavi works fine on my category page where the function is being called after the loop with wp_pagenavi()
- On my single page I have the same post list build with wp_query. The pagination is displayed and the pagelinks are correct (../page/2/) but when loading the url the parameters are removed and the same page is loaded
- My custom permalink structure is: /%category%/%postname%/
- My optional permalink base has no input
- My current query is this:
<?php $args = array( 'cat' => $category_id, 'posts_per_page' => 4, 'paged' => get_query_var('paged') ); $news = new WP_Query($args); $post_counter = 0; while ($news->have_posts() ) : $news->the_post(); $post_counter++; ?>
<?php endwhile; wp_pagenavi( array( 'query' => $news ) ); wp_reset_postdata(); ?>
Thanks in advance for having a look!
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]