It’s been a while since I developed themes for WordPress, so when I dived back into it, I expected to run into some issues…and I did. One of the problems that stood out due to the long hours I spent trying to figure things out was my wp_query with a custom post type and pagination.

On first look, everything looked fine, but whenever I clicked the page navigation, it always resulted in an error 404. I tried to check the permalinks and my code, and applied a bunch of other fixes I found on the net. Most didn’t work, until I stumbled on Devin Walker’s post. His solution sounded too simple (the simplest solution I found as I searched around), and seeing that the post was dated 2012 (more than 3 years as of this post), I thought this would have been outdated or fixed–but hey, it worked!

I had my posts_per_page argument for my query lower than that set by default on the admin settings (10), thinking this would override the defaults on the settings page. But as I found out, it doesn’t. In the admin section, go to Settings » Reading — Look for Blog pages show at most and set this to ‘1’. Take note that this isn’t a fix for all 404 issues, as I have seen solutions that point to other causes but also result in a 404.


Leave a Reply

Your email address will not be published. Required fields are marked *