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.

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 so here is a functions.php snippet to reverse comment order.

Using Functions.php Snippet

<?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 above option doesn’t work with your theme.

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.