Home » Programming / Coding

Next Page Link Shows 404 Page Not Found on WordPress

9 September 2008 3,419 views No Comment

WordPress seem to have this weird problem with the Next page link problem I just faced. I am not sure if it does happen with wordpress hosted version, this case scenario is for your own hosted wp blog. From the home page if you click on Next Page (which supposed to go to page 2) you would get 404 Page Not Found error. This doesn’t happen to every cases, generally happens if you change your Permalink setting to Month/Name generally.

Here is the solution to solve this problema:
Check your index.php file inside the theme folder you are using. Find the part that says posts_per_page=. In my case it shows posts_per_page=5 which means there would be 5 posts to be shown per page.

Now problem is there is another place you can set that posts per page number. control panel –> settings –> reading. Check out the entry that says “Blog pages show at most”; in my case it was set as 10.

Do you see the problem? Lets say you have 6 posts total. Since the theme is pulling total post count and calculating if there is more pages based on the hard coded 5 value on index.php it shows “Next Page”. Also showing 5 posts based on that hard coded value 5. But when you click on the Next Page link WordPress engine is not returning any posts, because its calculation is based on the settings –> readings value.

To solve this problem just make sure you have same value on index.php posts_per_page= part and also on “Blog pages show at most” at control panel –> settings –> reading.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.