0

I'd like to have my newest comments listed first but nothing seems to be working. In the dashboard I set

enter image description here

In comments.php I have

<?php wp_list_comments(array(
    'reverse_top_level' => true,
    'callback'      =>  'custom_comments_callback',
    'avatar_size'   =>  50,
    'reply_text'    =>  'Reply to this comment'
    )); ?>

And In functions.php I added

if (!function_exists('custom_reverse_comments')) {
    function custom_reverse_comments($comments) {
        return array_reverse($comments);
    }   
}

And still the oldest comments are shown on top. For an example, see this introduction to SPSS.

Oddly, the final result is different (better but not perfect) on a local version of my website with the exact same settings/files.

1 Answer 1

0

You have no need callback function. Only reverse_top_level: true is find for what you want to do. Just remove 'callback' => 'custom_comments_callback', from your array.

<?php wp_list_comments(array(
   'reverse_top_level' => true,
   'avatar_size'   =>  50,
   'reply_text'    =>  'Reply to this comment'
)); ?>
1
  • what about functions.php and the dashboard? Just removing the callback line doesn't help. In fact, it seems to remove some of the CSS applied to the comment list.
    – RubenGeert
    Commented Jun 5, 2016 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.