
Brotli压缩:GZIP压缩替代方案
comment_exists ( $comment_author, $comment_date, $timezone = 'blog' )
comment_exist: 这个函数检查一个具有特定ID的评论是否存在。
根据作者和日期来确定评论是否存在。
为了获得最佳性能,请使用`$timezone = ‘gmt’`,它可以查询一个被正确索引的字段。出于传统的原因,`$timezone’的默认值是’blog’。
function comment_exists( $comment_author, $comment_date, $timezone = 'blog' ) { global $wpdb; $date_field = 'comment_date'; if ( 'gmt' === $timezone ) { $date_field = 'comment_date_gmt'; } return $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_author = %s AND $date_field = %s", stripslashes( $comment_author ), stripslashes( $comment_date ) ) ); }