Display Most Recent Comments at the Top in WordPress

By default, WordPress posts and the page display older comments at the top. But if your blog posts are receiving a lot of constructive comments & suggestions, then you may not want the newer comments to be pushed to the bottom of the page. So if you want to display most recent comments at the top in WordPress Posts or page, then here’s how you can do that.

How to display most recent comments at the Top

Option 1: Change the WordPress setting

Jump to Settings > Discussion and select “newer” under “Comments should be displayed with the ….. comments at the top of each page”. Refer to the screengrab below.

Display Most Recent Comments at the Top

Option 2: Add quick hack in functions.php

Alternatively, you can add the below hack in functions.php file to reverse the comments displayed in the posts or page.

function wpb_reverse_comments($comments) {
return array_reverse($comments);
}
add_filter ('comments_array', 'wpb_reverse_comments');

The above code snippet uses the comments_array filter to reverse the comments.

Updated on June 10, 2020

Was this article helpful?

Related Articles

Leave a Comment