WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Display comments from newest to oldest based on timestamp

[Resolved] Display comments from newest to oldest based on timestamp

  • Hello,
    I’m trying to get the comments to display from newest to oldest based on the timestamp. I didn’t see an option for this, so I assume it’s something I need to tweak in the php code. Any help would be great!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Add this to your theme’s functions.php file:

    function reverse_comments($comments,$id) {
    $comments = array_reverse($comments);
    return $comments;
    }
    add_filter('comments_array','reverse_comments',10,2);

    It works! You’re AWESOME! Thanks for the fast response!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Display comments from newest to oldest based on timestamp’ is closed to new replies.