WordPress.org

Ready to get started?Download WordPress

Forums

nextpage tag (19 posts)

  1. phil404
    Member
    Posted 3 years ago #

    I am having a problem with the nextpage tag in WP 3.0, and it appears to be a rewrite bug.

    Post url:
    /category/year/month/post-slug/

    When I click the following pagination link:
    /category/year/month/post-slug/2/

    I am redirected back to the original post url.

    Manually loading the following url works fine:
    /category/year/month/post-slug/?page=2

    I'm pretty sure this was not an issue in WP 3 RC1. I can't remember if I ever tested post pagination in RC2 or RC3.

  2. phil404
    Member
    Posted 3 years ago #

    I still have not found any discussion on this bug.

  3. phil404
    Member
    Posted 3 years ago #

    After a bit of experimentation, I have discovered that the nextpage rewriting bug is only present when %category% is included in the permalink structure.

    nextpage works with this permalink structure:
    /%year%/%monthnum%/%postname%/

    nextpage does not work with this permalink structure:
    /%category%/%year%/%monthnum%/%postname%/

  4. phil404
    Member
    Posted 3 years ago #

    After even more experimentation, it seems my last post is not accurate.

    The nextpage tag works fine with the following permalink structure:

    /%category%/%year%/%monthnum%/%postname%/

    ...unless the post belongs to a child category.

    So, a URL of structure:

    /parent_category/child_category/year/monthnum/postname/

    will not paginate.

  5. Shane G.
    Member
    Posted 3 years ago #

  6. morticya33
    Member
    Posted 3 years ago #

    @phil404
    Did you happen to have any luck fixing this?

    I have the exact same problem, and according to here it seems like /%category%/%postname%/?page=2 works fine. (I've tested it as well)..

    Funny though, this has worked on older WP versions, if I'm not wrong..

  7. morticya33
    Member
    Posted 3 years ago #

    Just found out that if the post is in a sub-category and not the main category, it doesn't work as it should.

    So let's say you have two categories :
    Category A
    --- Category B

    And you've posted your post in Category A only, it works.

    If you've posted it in Category B only, and it links like this - /category-b/post-name/2 then it works.

    However if you have posted it in Category B only and the link is like this - /category-a/category-b/post-name/2 then it stops working.

  8. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    Have you re-tried this using the default permalink settings or one of the common settings?

  9. morticya33
    Member
    Posted 3 years ago #

    With default permalink settings it all works fine.

    For my end it only doesn't work with custom permalinks (/%category%/%postname%/) - well, I'm not really trying with any other combination :)

  10. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    I'm afraid you may have hit one of the potential permalink issues that are mentioned in the documentation. A custom structure that begins with a numeric might sidestep the issue.

  11. morticya33
    Member
    Posted 3 years ago #

    Ouch, noted then! Thanks for clarifying, esmi!

    Will just have to wait it out until this is fixed. :)

  12. SauloB
    Member
    Posted 3 years ago #

    Oh my god. I got the same problem on WP 3.0

    My site runs like this: /category-a/category-b/post-name/

    So, the pages does not work. All is broken, everything. What should I do to fix it? I mean, all the paged texts (A LOT!)

    Please, someone?

    I already tried the tip on documentation using a post id on the front, same thing.

    Thanks.

  13. fozloki
    Member
    Posted 3 years ago #

    Same problem, like noted on http://wordpress.org/support/topic/415454

    I use Pagebar2 for multipaging, so my very poor workaround was to edit the function create_link($page) in class-multipagebar.php not to use URLs like /cat/subcat/page/2, but /cat/subcat/page/?page=2

    $link = trailingslashit(get_permalink()) . '?page=' . $page;

    instead of

    if ('' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')))
    $link = get_permalink() . '&page=' . $page;
    else
    $link = trailingslashit(get_permalink()) . user_trailingslashit($page, 'single_paged');

    But that's not what I really want... looking forward for a bugfix!

  14. SauloB
    Member
    Posted 3 years ago #

    Did the same fozloki, thanks for the tip.

    I edited the plugin I use, Multi-Page toolkit.

    Using the same technique.

    Now, waiting for a official bugfix.

  15. pixeltrader
    Member
    Posted 3 years ago #

    @ fozloki

    We have the same Problem here one example:

    http://www.artikelmagazin.de/lifestyle/reisen/naturpark-schwarzwald-mitte-nord-freizeitspass-im-albtal.html

    But now we switch the Code in pagebar2 also to: $link = trailingslashit(get_permalink()) . '?page=' . $page;

    Thankx for this information. :)

    I hope that the Problem will fix soon.

  16. gusleig
    Member
    Posted 3 years ago #

    I have the same problem, when clicking on a page link it redirects to the same page... what I did while they solve this bug, remove the nextpage from content before displaying.

    In the single.php:

    <?php
    $content = $post->post_content;
    $content = str_replace('<!--nextpage-->','-', $content);
    $content = str_replace("\n<!--nextpage-->\n", ' ', $content);
    $content = str_replace("\n<!--nextpage-->", ' ', $content);
    $content = str_replace("<!--nextpage-->\n", ' ', $content);
    $content = apply_filters('the_content', $content);
    echo $content;
    ?>

  17. docarzt
    Member
    Posted 3 years ago #

    Thanks SauloB! A good temporary fix seems to be to download multi-page toolkit, install their nav elements into your template, then change line 162 from:

    $page_link_type = '/';

    to

    $page_link_type = '/?page=';

    and voila. It will work from there

  18. heygaryc
    Member
    Posted 3 years ago #

    This is a known bug with WordPress 3.0, and there is a bug fix logged in the Trac database, found here:
    http://core.trac.wordpress.org/ticket/13471

    As a temporary and immediate fix on my site, we made a very small change to the post-template.php file in the wp-includes directory.

    You need to replace line 622, which currently looks like this:
    $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';

    With:
    $output .= '</a><a href="' . trailingslashit(get_permalink()) . user_trailingslashit('?page=' . $i, 'single_paged') . '">';

    THEN, also replace line 636 in exactly the same way, replacing:
    $output .= '</a><a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';

    With:
    $output .= '</a><a href="' . trailingslashit(get_permalink()) . user_trailingslashit('?page=' . $i, 'single_paged') . '">';

    It should work fine after this fix.

  19. pixeltrader
    Member
    Posted 3 years ago #

    @ heygaryc

    Sorry, but this Trick don't work on my Blog.

Topic Closed

This topic has been closed to new replies.

About this Topic