wp query - How to get_comments() ordered by date and parent?

admin2025-06-03  3

So my starting point is:

<?php
  $comments = get_comments(array(
            'post_id' => $post->ID,
            'status' => 'approve',
            'type'=>'comment',
            'orderby'=>'comment_date',
            'order'=>'ASC'
        )); ?>

And that function does exactly what I told it to do :) I receive comments ordered by comment date.

What I would like to achieve is order comments ASC by date but get all children comments right below parent. It seems to work this way in all themes (probably with help of wp_list_comments and $reverse_children).

How to achieve this?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748960246a315173.html

最新回复(0)