Skip to:

Potential bug in topics pagination if topics per page < wp posts per page

  • Salvatore Formisano


    Hello everyone,

    as per subject I think I might have found an issue with the topics pagination.

    Here are my steps to reproduce:

    1) Install the bbpress plugin
    2) Create a few topics, enough to have some topics pages to test. For my example I have 48 topics.
    3) Go to the forum settings admin page and set the number of topics per page to a low number. I set it to 5
    4) Go to the wordpress reading settings admin page and make sure that the “Blog pages show at most” number is *lower* than the topics per page number you defined during step (3). In my case, I set it to 10.
    5) Finally, reach the forum topics page, e.g. (url may vary depending on your forum settings), and start browsing page after page

    When I follow these steps using the specific numbers I mentioned, as soon as I reach wordpress loads the 404.php template.

    As far as I can tell, this is what happened:

    1) Up to page 5, everything was good: I saw the right topics and the right number of them per page (i.e. 5)
    2) Under the hood, on the other hand, WordPress was paginating using the “Blog pages show at most” number as reference.

    Proof of point (2) is that I had 48 topics, which at 10 items per page would give you 5 pages. And WordPress returned the 404.php template on page 6.
    When “Blog pages show at most” is equal or smaller than “topics per page”, this issue does not present itself.

    If this is in fact a bug, I guess it could have gone uncaught because there’s hardly anyone around who would display less topics per page in their forum than posts per page in their blog.
    In case nobody else manages to reproduce this, I’d be happy to share more details about my setup, although it is pretty basic.


  • You must be logged in to reply to this topic.
Skip to toolbar