WordPress pagination gives 404 unless I set “Blog pages show at most” to 1
-
Ok so let me start of by telling you guys exactly what im doing and in what page. I am developing locally on MAMP and I am using “Custom Post Types” and “Custom Fields” Plugin. So I have a custom post type of “Products” and a custom taxonomy of “Types”
Anyways im trying to use my pagination in “Taxonomy.php” because thats where im going to display my custom post types of “products” with my custom taxonomy “types’ and use conditionals to generate different content on that same taxonomy.php.
So this is my code in taxonomy.php that I got from css-tricks
<?php $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('showposts=3&post_type=products'.'&paged='.$paged); while ($wp_query->have_posts()) : $wp_query->the_post(); ?> // my content from my custom field that I want paginated <p><?php the_field('image'); ?></p> <?php endwhile; ?> <nav> <?php previous_posts_link('« Newer') ?> <?php next_posts_link('Older »') ?> </nav> <?php $wp_query = null; $wp_query = $temp; // Reset ?>
Now I know this question has been asked a lot around the web and believe me I have at least read about 30 different articles and blogs about this and still cant seem to find a solution. With this method of displaying the paginations I got from css-tricks it works great but the only problem is I keep getting a 404 error message whenever I try to go to the next page UNLESS I SET MY “Blog pages show at most” TO 1 IN SETTINGS > READING. If I do that then it works otherwise it gives me the 404 page. My permalinks are set to Post Name by the way.
So I can see my pagination here:
https://localhost/MyWebsite/types/cars/
but when I get here I get the 404 page.
https://localhost/MyWebsite/types/cars/page/2/
I have read about the Flush Method and that does not work and I only have 2 plugins activated custom post types and fields and those are not the problem.
Another thing I have noticed is that the ‘Blog pages show at most’ number in settings > reading has to be smaller than the “Syndication feeds show the most recent” if I even want at least one page to work
Any suggestions would be greatly appreciated.
- The topic ‘WordPress pagination gives 404 unless I set “Blog pages show at most” to 1’ is closed to new replies.