Top

Daily Tip: How to Reverse WordPress Comment Order to Show the Latest on Top

April 2, 2011

Here’s a handy little hack that I found over at iwebsource.net. It basically reverses your comment order to show the latest ones on top, so that you don’t have to scroll all the way to the bottom to find read the most recent comments.

Add this to your theme’s functions.php file:

if (!function_exists('iweb_reverse_comments')) {
    function iweb_reverse_comments($comments) {
        return array_reverse($comments);
    }
}
add_filter ('comments_array', 'iweb_reverse_comments');

I tested this hack on the WordPress 3.1 and it works as advertised. It’s very useful if you have posts that get pages and pages worth of comments.

Tweet This Post

Comments

Got something to say?

Bottom
Article Archive  |  This site is a historical archive of pressography.com, a WordPress plugin and theme blog that published between 2006 and 2012. It is preserved for reference and is not operated by, affiliated with, or endorsed by its original authors. Nothing here is for sale and no form on this site is active. If you are the original owner and would like this domain returned, please get in touch.