From eefe4db92b8ac55ceffa93125c2c7db88ca98a54 Mon Sep 17 00:00:00 2001 From: Zhang Weilong <5152313@qq.com> Date: Fri, 17 Oct 2025 13:21:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=AD=E7=9B=B4=E6=8E=A5=E6=8B=BC=E6=8E=A5?= =?UTF-8?q?SQL=E8=AF=AD=E5=8F=A5=E5=87=8F=E5=B0=91=E6=B3=A8=E5=85=A5?= =?UTF-8?q?=E9=A3=8E=E9=99=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/core.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/core.php b/inc/core.php index 2fc3b3a..416799e 100755 --- a/inc/core.php +++ b/inc/core.php @@ -394,7 +394,7 @@ function get_readers_wall( $count = 12 ) { global $wpdb; if ( false === ( $result = get_transient( 'readers_wall' ) ) ) { // 根据评论邮箱查询排名前N名评论者 - $sql = "SELECT COUNT(comment_ID) AS cnt, comment_author, comment_author_url, comment_author_email FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->posts.ID=$wpdb->comments.comment_post_ID) WHERE comment_date > date_sub( NOW(), INTERVAL 3 MONTH ) AND user_id='0' AND post_password='' AND comment_approved='1' AND comment_type='comment' GROUP BY comment_author_email ORDER BY cnt DESC LIMIT $count"; + $sql = $wpdb->prepare( "SELECT COUNT(comment_ID) AS cnt, comment_author, comment_author_url, comment_author_email FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->posts.ID=$wpdb->comments.comment_post_ID) WHERE comment_date > date_sub( NOW(), INTERVAL 3 MONTH ) AND user_id='0' AND post_password='' AND comment_approved='1' AND comment_type='comment' GROUP BY comment_author_email ORDER BY cnt DESC LIMIT %d", $count ); $result = $wpdb->get_results( $sql ); set_transient( 'readers_wall', $result, DAY_IN_SECONDS ); }