wp query – prevent get_comments() from returning comments not in comment__in


The query string comment__in takes an array of comment IDs to include. I have an array of comment IDs that I would like to assign to comment__in, such as $args['comment__in'] = $comment_IDs;. Some comment IDs in $comment_IDs do not exists in the database and some do. Regardless, when a comment ID exists in the database, it gets returned by get_comments($args). However when none of the comments IDs in $comment_IDs exist in the database, get_comments($args) returns a large number of comments that are not in $comment_IDs

The question is:
How can I get get_comments($args) to only return comments specified by $comment_IDs?

Fabian Amran 1 year 2021-07-27T20:31:47-05:00 0 Answers 0 views 0

Leave an answer