Support » Fixing WordPress » Next Page not working, only on main blog index

  • At the bottom of my main blog page ( showing latest 4 entries), the “Next Page >” link doesn’t work.

    It links to:

    Where it *should* actually link to is:

    If I load that 2nd URL manually into the browser, I can browse my archives successfully. But it won’t work from the automatically generated link:

    <p align="center"><?php posts_nav_link() ?></p>

    That is in my index.php file in my template.

    When I’m in one of my categories (eg DMK News, with 11 entries), this works as it should.

    If I hard-code the above code on the main index to be:

    <p align="center"><a href="">Earlier Posts &raquo;</a></p>

    Then it breaks once it is showing on page 2 and subsequent pages…. as this code is used, not the proper navigation that it usually generated by posts_nav_link.

    I’ve read through about 20 relevant support topics on this, but haven’t found a solution. Most are where people NEED to have the link I am currently getting, and they don’t want the one I need. Or it’s an IIS issue with Windows, or domain pointing, and I have none of that as an issue. Same for the posts_nav_link page of the Codex, that didn’t help me either.

    In trying to find a solutioni, I (stupidly it turned out!) tried to set my Site URL in the general options to be:

    But once I hit update, I lost my whole WordPress interface, and my whole website lost complete templates/styling – just plain database page entries. Had to manually edit the database table to fix that, to restore the old value.

    I thought it might be that because my blog displays as:


    actually works. So I tried also looking at:

    But when I hard-code it to I get “Sorry, no posts matched your criteria.” — which is the error message I’m getting now for when I try to go through my archives.

    I have a static home page ( is base/blog address, and “home” is the page slug).

    Permalinks are working fine, browsing pages of posts is working fine in categories, not just on main page. I also tried disabling each plugin I use (only 5 of them, and none are affecting this code), and I don’t use the Adhesive plugin which seems to cause navigation troubles for some other users.

    I have 2.1.3 running, but this has been happening for a while. I just decided today to try and fix it, as I was already doing the 2.1.3 upgrade.

Viewing 15 replies - 1 through 15 (of 15 total)
  • I’m still having the same problem with the issues described above, any help would be very much appreciated, thanks!

    I am curious if you remove the “static frontpage” does it work?
    If yes, then it must be an old (pre-2.1) bug: in those versions when we were using a home.php template file in the theme – it also broke the next/prev navigation.

    rudolf45 — yes, it does work when I remove the static front page setting and just have my latest blog posts!

    If it’s an old bug, does that mean I wait until it’s fixed in an upcoming release, or is there a fix/solution in the meantime?

    Many thanks for identifying the problem! I’d tried turning off plugins, but not changing static homepage setting (using 2.1.3).

    I have a similar problem. posts_nav_link works in every page but not in my front page: but if I go to it works. On front page it generate this link:
    I had read everything I could but I had not found any solution.
    Thanks in advance for your help.

    I fixed my problem by editing function get_pagenum_link in link-template.php.
    I added
    $qstr = str_replace"index.phpIndex.php","index.php",$qstr);
    return $qstr;
    Hope this help.

    I tried it, couldn’t get it to work. Any help?

    I have the same index.phpIndex.php problem.
    I tried modifying the link-template.php as Latintop suggest but didn’t work for me.
    Any suggestion?

    Try this, see if it works.

    $qstr = str_replace("index.phpIndex.php","index.php",$qstr);

    LOL Latinpost missed out the bracket in the code .

    But this certainly work , just make sure the code is correct and placed just before return $qstr

    for WP 2.3, you need to use the following

    $result = str_replace("index.php/Index.php","index.php",$result);

    not sure if my problem is 100% the same. when you click the next page link at the bottom of my main page the address changes to but it is all the same posts as the main page. if i keep clicking next every page is still the same. i can’t seem to locate the link-template.php file mentioned above, where might i find it?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    not sure if my problem is 100% the same.

    Bet it’s not. Do you have a reference to “query_posts” anywhere in your theme?

    i found

    ‘<?php $temp_query = $wp_query; query_posts(‘showposts=5&cat=all’); ?>’

    in the index.php page

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Well, there’s your problem then. Change the query posts bit to this:


    awesome, that did it. thanks a bunch Otto42.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Next Page not working, only on main blog index’ is closed to new replies.