I need a way to get just the comments that aren’t top level i.e. where parent is not 0.
I’ve tried:
$args = array(
'parent' => -0
);
$comments = get_comments($args);
I know the parent comment id’s (44 and 48) of all the comments I require, so I tried:
$args = array(
'parent' => array(44,48)
);
$comments = get_comments($args);
But this didn’t work. It only returned one row.
I need to stick with get_comments() if possible, as I’ve done a lot of work around it already so want to avoid losing what I’ve done.
You cannot do that with a parameter for
get_comments()
, but filtering'comments_clauses'
should do it.Sample code, not tested:
Get comments of a specific comment parents…
(If you are not forced to do it with
get_comments()
)You can pass an array of comments to
wp_list_comments()
as the second argument.It will only work with âflatâ output, though.