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');

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

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.

Have any of your own related WordPress hacks you'd like to share? Let us know in the comments below.

Sarah Gooding Sarah is a designer and developer who specializes in WordPress. She and her husband operate Untame, where they build business websites, online stores, and social networks using open-source technologies. She is a former author for WPMU DEV on all things WordPress, Multisite, and BuddyPress.