Fix Reversed Comments Pagination

For every post I write on this site, I get hundreds of comments[1]. So, I needed a way to paginate older comments and only display the freshest comments by default.

So, I made my discussion settings like this:

Your comments settings must be like this, or the plugin will not kick-in

The Problem

If I had 21 comments on a certain post, WordPress will only show one comment, #21. The second page will show comments 20 to 1.

This is dumb. As Bill pointed out, “this makes very little sense to a visitor, who sees that there are [21] comments, but only sees one comment (#21) on the landing page, and must immediately page through the comments to even see #20.”

The Plugin

This plugin fixes this problem.

Download the Plugin

You can download the plugin from

How to Install

After you upload and activate, you must make a minor modification to your theme.

In your theme’s comments.php, you’ll see wp_list_comments. Replace it with:

if (class_exists('Walker_Comment_Wink'))
  $walker = new Walker_Comment_Wink();
  $walker = '';
wp_list_comments(array('walker' => $walker));

That’s it.

The Plugin is Stable

I’m using this plugin on WinkPress and have tested it else where. It works great. But your setup might be different than mine. If you notice any issues that I overlooked, tell me in the comments.

26 comments. You can post one, too!

  1. Ivan

    Used it on 4.1 and it works just fine! Thank you!

    • Mizagorn

      Thanks for the confirmation, Ivan!

      I am in the process of taking over WinkPress (stayed tuned, it’s gonna be awesome!), and I will be updating this article according to your info. :)

  2. Margje

    @billseymour / @ M.K.

    This is exact what i’m looking for but can’t get it work. Is it still possible to use your plugin?

    Thanks in advance!


  3. Margje

    @billseymour / @ M.K.

    This is exact what i’m looking for but can’t get it work. Is it still possible to use your plugin?

    Thanks in advance!


  4. DeltaHF

    I can’t thank you enough for this plugin – this should definitely be in the WordPress core.

    Please keep up the good work, I will be donating!

  5. Pesi

    Just a little trick to invert the page order for comments (your plugin and this code return the best pagination style for me)
    add this to your theme function.php:

    /** invert comment pages and order */
    if (!function_exists('custom_reverse_comments')) {
    function custom_reverse_comments($comments) {
    return array_reverse($comments);

    then in the “discussion settings” of your admin panel select “first” page as default and “older” comments at the top.
    Doing so, will return your last comments always in first page.
    bye and thanks for this great plugin :-D

  6. Harri Luoma

    I would like to display “older” comments at the top of the page. Is this possible with this plugin?

    • No, that’s not possible. This plugin is designed to take effect only when newer comments are set to be displayed at the top.

    • Harri Luoma

      Would it be hard to modify the plugin to make it possible?
      If this is something you could do, I would be more than happy to pay you for the work.

    • Can you explain in more details what exactly it is that you’re trying to achieve and what problem you’re trying to solve? (I’m a bit overwhelmed right now to try to figure this out on my own.)

    • Harri Luoma

      Well, basicly I’m trying to solve exactly the same problem that you had.. I would just want to show newer comments at the end of the page. It’s what my visitors are used to and it seems to be the WordPress standard.

    • Hi Harri, I tried to do what you want, but I couldn’t easily get it to work. I’ll have to, like, sit down and try to figure it out. Unfortunately, I’m very busy at the moment and wouldn’t be able to take this on—even as paid work…sorry!

    • Harri Luoma

      I have a solution.

      Install the Fix Reversed Comments Pagination plugin.

      Then you have to use jQuery order reverser plugin written by Corey H Maass.

      First thing – Edit comments.php

      search for:

        (as in twentyeleven theme)

        add an id so that it becomes

          and add:


          in header.php

        1. Hi,

          I did it, on my blog i am able to display always the same amount of comments, right now is set to 60, so I will always display 60, and the newer one at the bottom of the page… I have pages with over 500 comments, and this was the solution I have been looking for, nice thanks! BTW I am using Coraline Theme

        2. Hi,

          It would be better to do that on a server side instead of doing it with javascript. I made the following edits to the plugin code:

          1. Comment out lines

          // If comments are not newer to oldest
          if (get_option('comment_order') != 'desc')
          return false;

          in wink_good_discussion_settings() function.

          2. In function paged_walk(…) replace the lines

          if ( !empty($args[0]['reverse_top_level']) ) {
          $top_level_elements = array_reverse( $top_level_elements );

          $page_num = 1 + ceil($total_top / $per_page) - $page_num;

          $start = ($page_num - 1) * $per_page;
          $end = $start + $per_page;


          $page_num = 1 + ceil($total_top / $per_page) - $page_num;
          if ( !empty($args[0]['reverse_top_level']) ) {
          $top_level_elements = array_reverse( $top_level_elements );

          $start = ($page_num - 1) * $per_page;
          $end = $start + $per_page;
          } else {
          $start = $total_top - ($page_num) * $per_page;
          $end = $start + $per_page;

          I ran a few quick tests. It seems to work fine and caters for both sorting orders.
          Thanks for the plugin, btw.

      1. jarro

        works great thanks.

      2. billseymour

        Touching base here again with an observation: I have lately been working with WP themes from, and I have just noticed that the plugin does not seem to be working on comments. I have checked this with two parent themes, Hybrid and Prototype.

        I have not had a chance to look into this further, but you might want to test the plugin yourself on one of these themes, which are popular and have an active following. –Bill

        • billseymour

          Update: I just realized that I may not have passed the wp_list_comments parameter in the themes I discussed above, which obviously will affect things. I will experiment with this further, and post my results here. (Sorry for any confusion)

        • billseymour

          Yes, the plugin works in Prototype theme. It takes a little figuring out to find the right add_filter in the theme, but yes, the Plugin works fine. Good work!

        • Fantastic! If somebody now runs into a similar issue with Theme Hybrid, they have you to ask ;). Thanks for reporting back.

      3. Great work on this! I did find one bug: there is no output when specifying type=comments via wp_list_comments. It’s not an issue where I’ve implemented the plugin, but wanted to bring it to your attention.


        • Brian, I just tested it and it works fine with 'type' => 'comment'. Make sure you set the ‘type’ => ‘comment’ correctly. For example, here’s what I have:

          if (class_exists('Walker_Comment_Wink'))
            $walker = new Walker_Comment_Wink();
            $walker = '';
              'callback' => 'twentyten_comment',
              'max_depth' => 2,
              'type' => 'comment',
              'walker' => $walker


        • Sure enough. Must have been with the way WP was parsing the args, I was just passing them as wp_list_comments(‘arg=value&arg=value’). Nice work, again!

      4. Brilliant, thanks.

        Exactly what I wanted to do myself, because I’ve hacked my comments.php template to:

        *) only show the last page of comments by default
        *) provide a “load all comments” link and provide convenient AJAX-enabled comment paging using the wp-comment-master plugin.

        The dumb default way of cutting off the last page was something I found extremely annoying and I could solve it by modifying the comments system in the core. This plugin is, of course, a much better solution, because it will survive WordPress updates and does not disturb the comment paging when the settings dictate a different way of comment pagination (my own solution totally ruined the paging when the settings didn’t match).

      5. billseymour

        (this comment was also posted on the original Ideas thread)

        Bravo!- your solution is working just fine. A few notes:
        – Your plugin works with Greg’s Threaded Comment Numbering plugin.
        – Your plugin works with a custom callback in wp_list_comments

        Good work. Thanks so much.

        (Just in case someone wanted to see code for both points above. In comments.php, replacing wp_list_comments() with your code and modified wp_list_comments )

        if (class_exists('Walker_Comment_Wink'))
          $walker = new Walker_Comment_Wink();
          $walker = '';
        wp_list_comments(array('walker' => $walker, 'callback' => 'my_custom_callback_func'));
        • Thanks for your comment and the code snippet, Bill!

          I think the plugin should work with most setups and other plugins without a hitch — provided one makes the wp_list_comments call correctly, like you did in your example.

      Leave a comment

      Your email address will not be published. Required fields are marked *

      Read this to make your comment cool.