How To Reverse The WordPress Comment Order to Show Newest on Top

Whether your theme shows newest comments on top or oldest you may want to change the order of comments in WordPress. Seeing the latest comments on top can also help users engage more with your content. No matter what order you (or your visitors) prefer here are 2 simple ways to rearrange WordPress comments.

First I’ll show you how to reorder your comments using the built-in WordPress option:

Using WordPress Comment Order Option

There is a built in option located in Settings/Discussion that will allow you to reverse the order of your WordPress comments.

WordPress comment order option

This method may not work with all themes since they could be using custom methods to display comments.

Change WordPress Comment Order using Functions.php Code Snippet

If you’re a more advanced user you can use this code snippet in your functions.php file or using the Code Snippets plugin to reverse comment order:

<?php
//Reverse comment order
function smartwp_reverse_comment_order( $comments ) {
return array_reverse( $comments );
}
add_filter ('comments_array', 'smartwp_reverse_comment_order');

This code snippet will reverse the order of your WordPress comments. This is helpful if the default WordPress option doesn’t work with your theme.

If you are new to adding code snippets to your site you can watch this video that shows two methods to add them to your site.

Andy Feliciotti

Andy Feliciotti

Andy has been a full time WordPress developer for over 10 years. Through his years of experience has built 100s of sites and learned plenty of tricks along the way.

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Tips Monthly

Get the latest from SmartWP to your inbox.