From 9ba85587b96a97b6a29adad827bd9c7698eae8a3 Mon Sep 17 00:00:00 2001 From: kagg-design Date: Mon, 11 Mar 2024 12:36:36 +0300 Subject: [PATCH] Add comments to posts with post_status=(publish, private) and comment_status=open only. --- src/php/Generator/Comment.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/php/Generator/Comment.php b/src/php/Generator/Comment.php index fe3b582..3a8e02f 100644 --- a/src/php/Generator/Comment.php +++ b/src/php/Generator/Comment.php @@ -340,7 +340,9 @@ private function prepare_posts(): array { "SELECT p.ID, post_date, post_date_gmt FROM $wpdb->posts AS p INNER JOIN - (SELECT ID FROM $wpdb->posts WHERE post_type = 'post' ORDER BY RAND() LIMIT %d) AS t + (SELECT ID FROM $wpdb->posts + WHERE post_type = 'post' AND post_status IN ('publish', 'private') AND comment_status = 'open' + ORDER BY RAND() LIMIT %d) AS t ON p.ID = t.ID;", $this->random_posts_count )