I’ve been struggling with this for the last couple of days, and I can’t get it to work.
When I click on page 2 it takes me back to the home page, even the URL is the one for the home page. When I click on page 3 or 4 or whatever page number is greater than 2, it works perfectly.
I have already tried using WP_Query or get_posts instead of query_posts, but nothing has worked – some other tries were even worse!
I tried having wp_reset_query after, before, in the middle of the loop or the wp_pagenavi() call and still the same.
Would anyone please have any suggestion to fix this? I’d appreciate any help very much.
Here’s my code:
<?php get_header(); ?> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'cat' => 10, 'order' => 'DESC', 'paged' => $paged, ); query_posts( $args ); ?> <?php while( have_posts() ): the_post(); ?> <p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> <?php endwhile; ?> <?php wp_pagenavi(); ?> <?php get_footer(); ?>
- The topic ‘Page 2 sends me to home page, pages 3 and above work OK’ is closed to new replies.