How To Rearrange Comments in WordPress – Display the Most Recent One on Top

Posted on August 30th, 2009 by in Tutorials | 15 Comments  
How To Rearrange Comments in WordPress – Display the Most Recent One on Top

Rearranging comments to display the latest one on top is becoming a new trend that more and more top bloggers are implementing on their site. If your blog has a lot of user interaction, then this option should be your choice because often the recent comments get buried on the last pages or at the very bottom. In this article we will show you how you can rearrange your comments and display the most recent one on top.

There are multiple ways that have been shared online and some even require you to edit your core files. Editing core files is never a good option because every time you upgrade WordPress, you have to make that change again. We have two ways that you can use to rearrange comments and display them in the descending order showing the most recent comment first that will not require you to change the core files at all.

Method 1

This method requires you to add a simple code to your comments.php. First you need to find the line:

foreach ($comments as $comment) {

Note: These may vary slightly in different themes. Immediately before this line you need to add:

add $comments = array_reverse($comments);

With the reverse function, you can rearrange comments and show them in the descending order.

Source: Demonboy

Method 2

The second method makes the job even easier for those who are not good with codes. It is a plugin called Simple Reverse Comments. With this plugin, you do not have to edit any template files at all. Simply download the plugin and activate it.

Download this Plugin from WordPress Plugin Directory

About

Editorial Staff at WPBeginner mainly Syed and David.

Post comment as twitter logo facebook logo
Sort: Newest | Oldest
rexcollin91 5 pts

I think this is one of the most important info for me. And i'm glad reading your article. But should remark on some general things, The website style is wonderful, the articles is really excellent

tonchavez17 5 pts

I am typically to running a blog and i really respect your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for new information.I am typically to running a blog and i really respect your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for new information.

shainatim 5 pts

I prefer method 2, it is easier than codes. I hate codes coz I am not good at it. Thanks for the plugin.

@Grace T In your Dashboard, drop down the Plugins list and click Add New. In there you will see a link on top to Upload. Click that and then the Browse button to locate the ZIP file you downloaded. Then click Install Now.

You may be prompted for your FTP login details. If you are, enter it and click the Proceed button. The next page will show 2 links: Activate Plugin and Return to Plugins page. Click Activate Plugin to start using it now.

I downloaded the plugin, but I'm really not great with technology, so how do you activate it? This sounds like a stupid question, but I really need help!

@Jim Hutchinson: That discussion settings stuff doesn't work at all.

@Editorial Staff: It would have been better if you just said replace with .
I had to go to the wordpress forum to find this solution.

A plugin is not needed for this. Just go into the Discussion Settings and select how you want the comments to show, older or newer.

"Comments should be displayed with the [older][newer] comments at the top of each page"

Oh, I just realised you're right! Thankyou!

I see that this plugin has not been updated since 2008 so I'm wary about using it.

Also, I do see the setting in Discussion and have set my comments to display Newest at the top, but that doesn't seem to work.

Anyone have any thoughts?

thanks

Use the default option in the Discussion area.

Will it work with Disqus?

I am having a custom WordPress theme developed by someone from elance.com and I would like to know whether or not I'll be able to install plugins such as Simple Reverse Comments because my theme is custom. Can you shed light on this? Maybe I should cut my losses and go with something like the Thesis theme which is more cookie-cutter? Thank you for your blog, it has been very helpful to me.

You should be able to install this plugin in your custom theme.

Tweets about us: