We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4844a73 commit 92e46edCopy full SHA for 92e46ed
includes/collection/class-posts.php
@@ -505,13 +505,13 @@ public static function purge( $days ) {
505
* Local user comments have a user_id > 0, while Fediverse comments have user_id = 0.
506
*/
507
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
508
- $local_comments = (int) $wpdb->get_var(
+ $has_local_comments = (bool) $wpdb->get_var(
509
$wpdb->prepare(
510
- "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND user_id > 0",
+ "SELECT 1 FROM $wpdb->comments WHERE comment_post_ID = %d AND user_id > 0 LIMIT 1",
511
$post_id
512
)
513
);
514
- if ( $local_comments > 0 ) {
+ if ( $has_local_comments ) {
515
continue;
516
}
517
0 commit comments