Support » Themes and Templates » Next/Previous Links not working

Viewing 15 replies - 1 through 15 (of 36 total)
  • I’m still stuck with this one if anyone is able to offer help?


    I’m having the same problem on my blog (, and didn’t find any helping resources so far. I’ve noticed though, that if you remove “blog” from the URL on your blog (i.e.,, you are pointed to the right page.

    The url I get when I click “Previous Entries” on my blog is:

    Notice that “index.php” appears twice. If I remove it from the URL, I get the right behaviour.

    Our problems seem to have a common source. I’m sensing that this have something to do with permalinks. My blog runs under IIS.

    Hope that one of the bright minds behind WordPress can help us out with this one.


    Do you have the .htaccess in your root directory and is it config right?

    You can try to change code, remove the posts_nav_link() function in your index.php and replace it with something like
    <a href="<?php echo $paged+1; ?>/">Older Entries</a>

    Thanks haochi, that’s a patch that works better than what I’m getting now. But it has some problems at the limits of the navigation. I think I need to detect the reaching of the last page and hide the link. Since I’m not “fluent” in php, I guess I’m going to apply your patch for now. Readers of my blog will get a “page not found” message when all pages are navigated, which is way better than what they’re getting now.

    Thanks again.

    I have the same problem as jhob had. I’m using the WP Page Navi plugin, and it worked just fine before, but now I have a static homepage. I used the Settings > Reading > Front page displays – A static page (select below) route, so I don’t actually have a separate folder for the blog, but all blog entries are under

    Here’s my site if you want to see what I mean:

    I have seen this method used before and it worked, but somehow it’s not working for me. When I go to
    it stays as the same page as the first page of the blog.


    The index.php is not listed twice in your link. One is index.php and the other is Index.php if your blog is running on a linux or unix server then they are 2 different documents as these servers are case sensitive. Get rid of the Index.php, it may not solve this problem but keeping it there is not going to help. (do download a copy of the file so you can compare them)

    I’m having this same issue too and I don’t really understand your solution. How do you remove “Index.php”?

    You can see my site here:


    I had the same problem, but I found a work around:

    $offset = "0";
    $no_of_posts = "2";
    if (preg_match('/page/', $_SERVER['REQUEST_URI'])) {
    	$uri = explode('/', $_SERVER['REQUEST_URI']);
    	foreach ($uri as $key=>$value) {
    		if ($value == "") {
    	$offset = array_pop($uri) * $no_of_posts;
    query_posts('showposts=' . $no_of_posts . '&offset=' . $offset);
    if (have_posts()) :

    And continue your loop. Use the next_posts_link and previous_posts_link as you normally would.

    Have a look at it in action here:

    oops, missed a bit:`

    $offset = “0”;
    $no_of_posts = “2”;
    if (preg_match(‘/page/’, $_SERVER[‘REQUEST_URI’])) {
    $uri = explode(‘/’, $_SERVER[‘REQUEST_URI’]);
    foreach ($uri as $key=>$value) {
    if ($value == “”) {
    $offset = (array_pop($uri) * 2) – 2;
    query_posts(‘showposts=’ . $no_of_posts . ‘&offset=’ . $offset);
    if (have_posts()) :`

    That should work.

    Hi Adam,

    And where exactly do we have to paste that code? Our theme’s index.php? and where exactly? which lines?

    Thank you very much!


    there is two possible thing that i can think of why it doesnt show

    1. post is less than “max page per post” range.
    2. outside of loop scope (doesnt have post)

    try add the below code above the next/prev code. ( just to make sure )

    <?php rewind_posts();?>

    I’m having a similar problem but in my case my nav links when viewing a category strip out the category info form the URL and it goes to the next page of the main archive.

    When I go to
    and select next page, it goes to
    rather than

    I’ve been going crazy to figure this out. I have no idea when it started.

    Hi everyone.

    I’m experiencing a similar problem but with a difference:

    When I create a gallery in a page, the next/previous image navigation works fine.

    When I create a gallery in a post, the next/previous image navigation doesn’t work at all.

    Can anyone think what might be causing this?

    I’m on WordPress 2.6.0

    Me, too.

    I have almost been crazy. What should I do to solve this big problem.

    See my previous entries:

    I have no way but manually add “Older Posts” with the right link:

    I really hope WordPress or someone could solve this issue. I have been crazy for this since I have no good way to troubleshoot it.

    I have run into the same problem. Perhaps we need to be looking at the htaccess file instead of the php…alas I am not versed in that area.

Viewing 15 replies - 1 through 15 (of 36 total)
  • The topic ‘Next/Previous Links not working’ is closed to new replies.