How To Reverse The WordPress Comment Order To Show The Latest On Top

How To Reverse The WordPress Comment Order To Show The Latest On Top

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. This way 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:

{code type=php}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.

Sarah Gooding
Sarah Gooding Sarah enjoys staying on top of the latest WordPress and BuddyPress news. Get in touch with Sarah on Twitter @pollyplummer.
Have any of your own related WordPress hacks you'd like to share? Let us know in the comments below.