Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How To Display the Most Recent Comments First in WordPress

Do you want to display the most recent comments first in WordPress?

By default, WordPress displays older comments first. However, you may want to change this so the most recent comments appear on top.

In this article, we’ll show you how to easily rearrange comments in WordPress and display the most recent comments first.

Display newer comments on top in WordPress

Why Display the Most Recent Comments First in WordPress

By default, WordPress shows comments in the order they’re posted, so the oldest comments appear first. This means the post’s oldest comment is the first thing visitors see.

The WordPress comment section, with oldest comments first

Many site owners use comments to boost user engagement and showing outdated comments isn’t the best way to spark a new conversation. By displaying the most recent comments first, you can encourage visitors to join the discussion and keep the conversation going. This is a great way to get more comments on your WordPress blog.

Prominently showing the most recent comments can also make your site look more fresh, lively, and engaging. This can increase pageviews and and reduce bounce rate in WordPress.

That being said, let’s see how you can easily display the most recent comments first in WordPress. Simply use the quick below to jump to the method you want to use.

1. Display Newer Comments First in WordPress Settings

The easiest way to rearrange your comments is by heading over to Settings » Discussion in your WordPress dashboard.

Showing newest comments first in the WordPress settings screen

In the other ‘Other comment settings’ section, find ‘Comments should be displayed with…’

This is set to ‘older comments at the top of each page’ by default, but you can open this dropdown and choose ‘newer’ instead.

Showing the most recent comments first in WordPress

Once you’ve done that, just scroll to the bottom of the page and click on ‘Save Changes’ to store your settings.

Now if you visit any page or post, you’ll see the newest comments first.

2. Manually Set Comment Display Order in WordPress

The first method is the easiest, but there are some scenarios where the WordPress settings may not work.

For example, you might have created a custom WordPress theme, or you may be working on a multi-author WordPress blog and don’t have permission to access the settings page.

In that case, you can show the newest comments first by adding code to your WordPress website. Normally, you would need to add custom code snippets to your theme’s functions.php file.

However, we don’t recommend this method as even a small mistake in your code could cause a number of common WordPress errors, or break your site completely.

That’s why we recommend using WPCode. It is the easiest and safest way to add code snippets in WordPress without having to edit any core WordPress files.

The first thing you need to do is install and activate the free WPCode plugin on your website. For more details, please see our step-by-step guide on how to install a WordPress plugin.

Upon activation, go to Code Snippets » Add Snippet in your WordPress dashboard.

The WPCode WordPress code snippet plugin

Here, you’ll see all of the different ready-made snippets that you can add to your site. This includes a snippet that allows you to completely disable comments and disable the WordPress admin bar.

Since we want to add our own snippet, hover your mouse over ‘Add Your Custom Code,’ and then click ‘Use snippet.’

Changing the order of WordPress comments using code

To start, enter a title for the custom snippet. This can be anything that helps you identify the code snippet in your WordPress dashboard.

After that, open the ‘Code Type’ dropdown and select ‘PHP Snippet.’

Adding custom PHP to your WordPress pages and posts

Now you can go ahead and paste the following snippet into the code editor:

function wpb_reverse_comments($comments) {
// Check comment order
$comment_order = get_option('comment_order');
 
// if comment order is default then change it.
if ( $comment_order == 'asc' ) {
return array_reverse($comments);
}
}
add_filter ('comments_array', 'wpb_reverse_comments');

This code starts by checking your WordPress settings. If the comment order is set to oldest first, then the code snippet will override this, so newest comments appear first.

Below the code box, you’ll see some insertion options. If it isn’t already selected, then choose the ‘Auto Insert’ method so the snippet will be automatically inserted and executed on your WordPress website.

After that, open the ‘Location’ dropdown and select ‘Run Everywhere.’

Run the comment snippet everywhere on your WordPress website

Then, scroll to the top of the screen and click on the ‘Inactive’ toggle so it changes to ‘Active.’

After that, click on ‘Save snippet.’

Saving a recent comments snippet in WordPress

To make the snippet live on your website, go ahead and click on the ‘Inactive’ slider so it turns to ‘Active.’

Finally, click on ‘Update.’

Showing newest comments first using code

Now, if you visit your WordPress website you’ll see the newest comments at the top of the comment section.

This code will force WordPress to show the most recent comments first no matter what changes you make to your WordPress settings. If you want to switch back to showing the oldest comments first, then you’ll need to disable the code snippet.

Simply go to Code Snippets » Code Snippets. You can now find your comment snippet and click on its toggle to turn it from active (blue) to inactive (grey).

Showing newest comments first using WPCode

We hope this article helped you learn how to display the most recent comments in WordPress. You may also want to see our guide on how to allow user registration on your WordPress website, or see our expert pick of the best WordPress membership plugins.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

21 CommentsLeave a Reply

  1. Thank you for this tip: $comments = array_reverse($comments);
    I tried the admin option of showing newest comments at the top and it didn’t work, but your code worked. Thank you!

  2. 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

  3. 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.

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

  5. @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.

  6. 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!

  7. @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.

  8. 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”

  9. 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.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.