The basic issue is that every paginated page for my blog is going to a 404 page. /page/2/, /page/3/, etc. It used to be working fine, but is not now. I think maybe the change to 3.9 did it.
Here are some of the many things I have tried in an effort to fix this. The end result of all of these were the same. The paginated links 404'd.
- deactivated all plugins
- removed and reset permalinks multiple times
- tried permalinks as default rather than /postname
- Ensured my Reading Settings > Blog pages show at most was set to the same number as my loop. (as well as more and less to test)
- I tried two separate navigation plugins and the default wordpress pagination (older posts) and it 404s every time. tried using parse_query
- tried paginate_links
Here is my code (or links to my code):
home.php
<?php require dirname( __FILE__ ) . '/blog-page.php';
blog-page.php
<?php
/*
Template Name: Blog Page - Custom
*/
get_header(); ?>
<---CUSTOM CODE--->
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'posts_per_page' => 5,
'post_type' => 'post',
'paged' => $paged
);
$wp_query = new WP_Query($args);
if($wp_query->have_posts()) :
while($wp_query->have_posts()) : $wp_query->the_post(); ?>
<---CUSTOM CODE--->
endwhile;
wp_reset_postdata();?>
<div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div>
<div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>
<?php endif; wp_reset_query();
If it helps, here is a test site I've set up with the page in question. I've left it off with the default wordpress pagination.
I've run out of things to try. Any suggestions would be appreciated.