Custom Post Type Archive Template Pagination 404 Error Fix
I like to create custom post types to better organize my website’s content. There are many great plugins to help you create custom post types without code. A few times I have run into 404 errors when creating custom archive templates for my custom post types with pagination set up. Here’s a few checks I do that typically solves my issue after receiving a 404 error:
1. If you are only testing pagination out and are using the ‘posts_per_page’ argument to limit the number of results this will conflict with WordPress’ default settings of 10 posts per page. If you are testing pagination go to Settings > Reading in the admin dashboard and change “Blog pages show at most” to 1.
query_posts( array( 'cat' => 8, 'paged' => get_query_var('paged') ) );
3. Double-check your code or plugin settings that you have indeed enabled archives with the has_archive parameter when you registered your post type.
4. If you have a page or post with the same slug as your custom post type name this can often cause issues. Check to see if this is the case and see if renaming that page or post’s slug fixes the 404 errors.
Problem still not solved? Take a look at How to Resolve WordPress Custom Post Type 404 Error Issues which is an article I wrote awhile back with some more tips.
Hopefully this provides you with a resolution! WordPress is great; it can be a little finicky but we still love it!