How to output comments in Descending order by date using wp_list_comments?
Question
I am using the following code to output comment html:
$args = array (
'post_id' => 805,
'status' => 'approve'
);
$comments = get_comments( $args );
$comments_html = wp_list_comments( apply_filters(
'woocommerce_product_review_list_args',array(
'page' => 2,
'echo' => false,
'callback' => 'woocommerce_comments'
)), $comments);
I used error_log
to output $comments
and it seems to be in descending order, which is correct as the setting for comment display in Settings > Discussions
is "Comments should be displayed with the newer comments at the top of each page"
.
However, on running wp_list_comments
, the order gets messed up. How to make this work with wp_list_comments
?
0
1 year
2022-01-26T08:26:23-05:00
2022-01-26T08:26:23-05:00 0 Answers
0 views
0
Leave an answer