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

推荐订阅源

S
Secure Thoughts
罗磊的独立博客
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Last Week in AI
Last Week in AI
美团技术团队
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
月光博客
月光博客
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
W
WeLiveSecurity
H
Heimdal Security Blog
Vercel News
Vercel News
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
WordPress大学
WordPress大学
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Help Net Security
Help Net Security
博客园_首页
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
I
Intezer
K
Kaspersky official blog
M
MIT News - Artificial intelligence
J
Java Code Geeks
G
GRAHAM CLULEY
P
Palo Alto Networks Blog

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

赞赏作者

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