惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

N25H

Maye Nano:拒绝臃肿,回归纯粹的快速启动工具 – N25H Maye Nano Script Help – N25H 国行三星 Galaxy Watch7 其他品牌手机解锁心电图、血压等功能 – N25H 推翻重做,彻底重写WordPress主题 – N25H WordPress 模板目前采用的缓存获取方案 – N25H 相册测试1 – N25H 相册测试2 – N25H 从 Typecho 迁移到 WordPress 的后续 – N25H 在Linux Ubuntu上挂载新硬盘 (临时、永久挂载) – N25H
WordPress 通过Hook修改评论Flood判定时间 – N25H
作者: N25H · 2023-12-12 · via N25H

如果是使用wp原生评论系统直接通过钩子comment_flood_filter拦截即可

在主题function.php文件中加入以下代码:

if ( !function_exists( 'mz_comment_flood_filter' ) ){
    function mz_comment_flood_filter( $dam_it, $time_lastcomment, $time_newcomment ) {

        if( !is_admin() ) {
            if ( ( $time_newcomment - $time_lastcomment ) < MZ_COMMENT_FLOOD_TIME ) { // 间隔为10秒
                return true;
            }
            
            return false;
        }
        
    }
}
add_filter( 'comment_flood_filter', 'mz_comment_flood_filter', 10, 3 );

这个回调的大概意思是,不在后台的情况下,用当前发布的时间减去上次的时间,如果小于MZ_COMMENT_FLOOD_TIME则判定为Flood,否则什么都不做

为了方便快速控制判断时间,这里定义了一个MZ_COMMENT_FLOOD_TIME

define('MZ_COMMENT_FLOOD_TIME',     10);

ps:函数add_filter,的参数依次为:hook名,回调,优先级,参数数量


详情参考:comment_flood_filter

赞赏作者

如果觉得我的文章对你有用,请随意赞赏