wp query - Child Comments not showing in `wp_comment_query`

admin2025-01-07  3

I'm working on a function that loads more Woocommerce reviews when a button is clicked. I have everything working,except the replies from the shop owner are not showing under the review.

I've performed some testing and I've discovered this: when the shop owner replies to a review displayed during the initial page load, the reply shows.

When the button is clicked to load more reviews - even when it clearly has a child on the back-end of the site - the children do not show up.

Here's my query args for the comments:

$args = array(
        'number' => 10,
        'type' => array( 'review', 'comment' ), // Tried "comment" because a reply is a comment, not a review
        'status' => 'approve',
        'post_id' => $_POST['id'],
        'meta_query' => array(
            array(
                'key' => 'rating', // Needed for filtering based on rating
                'value' => $_POST['rating'],
                'compare' => '=',
                'type' => 'NUMERIC'
            )
        ),

    );

I tried commenting out the meta_query above and still no luck.

Main Issue:

If I var_dump(get_comment(parent_comment)), it says it has no children. What am I doing wrong?

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

最新回复(0)