这里我们可以通过评论插件来用验证码限制,但是如果是人工评论,那也无法用评论验证码来拦截这些问题。于是,我们可以用到提高间隔时间的限制,比如我们可以设置一分钟只能评论一次,或者设置更长的时间。
//评论间隔无需插件 Edit By itbulu.com
add_filter('comment_flood_filter', 'suren_comment_flood_filter', 10, 3);
function suren_comment_flood_filter($flood_control, $time_last, $time_new)
{
$seconds = 60;//设置时间,默认是一分钟
if(($time_new - $time_last) < $seconds)
{
$time=$seconds-($time_new - $time_last);
err ('评论太快了,你需要等待'. $time.'秒后再次评论');
}
else
{
return false;
}
}这里我们只需要添加到当前的主题Functions.php文件中即可。