wp_throttle_comment_flood

函数
wp_throttle_comment_flood ( $block, $time_lastcomment, $time_newcomment )
参数
  • (bool) $block Whether plugin has already blocked comment.
    Required:
  • (int) $time_lastcomment Timestamp for last comment.
    Required:
  • (int) $time_newcomment Timestamp for new comment.
    Required:
返回值
  • (bool) Whether comment should be blocked.
定义位置
相关方法
wp_check_comment_floodcheck_comment_flood_dbwp_set_comment_cookieswp_trash_post_commentswp_update_comment_count
引入
2.1.0
弃用
-

wp_throttle_comment_flood是一个防止评论泛滥的函数,它检查由同一IP地址提交的两个连续评论之间的时间。如果两个评论之间的时间小于指定的阈值,该函数返回true,表明该评论不应该被接受。

决定一个评论是否应该因为评论泛滥而被阻止。

function wp_throttle_comment_flood( $block, $time_lastcomment, $time_newcomment ) {
	if ( $block ) { // A plugin has already blocked... we'll let that decision stand.
		return $block;
	}
	if ( ( $time_newcomment - $time_lastcomment ) < 15 ) {
		return true;
	}
	return false;
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 19:32:59

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: