如何在WordPress中更改Akismet的删除垃圾邮件时间表

After we published our article on how to change WordPress trash schedule, one of our readers asked if it was possible to change the delete schedule for spam comments in Akismet. By default, Akismet keeps spam comments in your WordPress database for 15 days before deleting them. In this article, we will show you how to change Akismet’s delete spam schedule in WordPress.

在我们发表了有关如何更改WordPress垃圾邮件时间表的文章后,一位读者询问是否可以更改Akismet中垃圾邮件评论的删除时间表。 默认情况下,Akismet会将垃圾邮件评论在WordPress数据库中保留15天,然后再将其删除。 在本文中,我们将向您展示如何在WordPress中更改Akismet的删除垃圾邮件时间表。

How to Change Akismet's Spam Delete Schedule in WordPress
为什么要更改Akismet删除WordPress中垃圾邮件的方式? (Why Change How Akismet Deletes Spam in WordPress?)

This tutorial is for Akismet plugin only. If you are not using it, then check our guide on why you should start using Akismet.

本教程仅适用于Akismet插件。 如果您不使用它,请查看我们的指南以了解为什么应该开始使用Akismet

Akismet allows you to combat comment spam in WordPress. It monitors all comments, pingbacks and trackbacks.

Akismet允许您与WordPress中的评论垃圾邮件斗争 。 它监视所有评论, pingback和引用

Spam comments reside in your database, which means they increase your database backup size. Deleting them sooner may help keep your database size a bit smaller.

垃圾评论位于您的数据库中,这意味着它们会增加数据库备份的大小。 尽快删除它们可能有助于使数据库大小更小。

While some users may believe that deleting spam comments improves database performance, we don’t think it has a major effect on database performance in most circumstances.

尽管某些用户可能认为删除垃圾邮件评论可以提高数据库性能,但我们认为在大多数情况下,这不会对数据库性能产生重大影响。

If you are receiving thousands of spam comments, and you try to delete them manually, then it could affect your site’s performance. See our guide on how to batch delete spam comments in WordPress.

如果您收到成千上万的垃圾邮件评论,并尝试手动将其删除,则可能会影响您网站的性能。 请参阅我们的指南,了解如何在WordPress中批量删除垃圾邮件评论

On the other hand, some users may want to keep spam comments for a longer period, so that they can review them later to avoid false positives.

另一方面,某些用户可能希望将垃圾邮件评论保留更长的时间,以便他们以后可以进行评论以避免误报。

Having said that, let’s see how you can change the delete schedule for spam comment in WordPress with Akismet.

话虽如此,让我们看看如何使用Akismet在WordPress中更改垃圾邮件评论的删除时间表。

使用Akismet更改WordPress中的垃圾邮件评论删除计划 (Changing Spam Comment Delete Schedule in WordPress with Akismet)

Akismet automatically deletes spam comments after keeping them for 15 days in your database. This gives you time to manually review spam comments.

在将垃圾邮件评论保留在数据库中15天后,Akismet自动删除垃圾评论。 这使您有时间手动查看垃圾邮件评论。

If it marked a genuine comment as spam, then you can mark it as not spam. This is how Akismet learns and improves it’s algorithms to catch spam comments more efficiently.

如果该邮件将真实评论标记为垃圾邮件,则可以将其标记为非垃圾邮件。 这就是Akismet学习和改进其算法以更有效地捕获垃圾评论的方式。

Comment spam folder

You can change the number of days Akismet should keep spam comments in your database. Simply add this code to your theme’s functions.php file or in a site-specific plugin.

您可以更改Akismet应将垃圾邮件评论保留在数据库中的天数。 只需将此代码添加到主题的functions.php文件或特定站点的插件中即可


add_filter( 'akismet_delete_comment_interval', 'custom_spam_delete_interval' );

function custom_spam_delete_interval() {
	return 7;
}

Change 7 with the number of days you want to keep a comment. This filter simply modifies Akismet’s spam deletion schedule.

将7更改为您要保留评论的天数。 该过滤器仅修改了Akismet的垃圾邮件删除时间表。

Changing the number to 0, will allow Akismet to delete all comments on its next comment delete schedule. This will not give you much time to review spam comments.

将数字更改为0,将允许Akismet在其下一个评论删除时间表中删除所有评论。 这将不会给您太多时间来审查垃圾邮件评论。

You can see your changes in action by visiting Settings » Akismet page. Scroll down to the bottom of the page, and you will see a note in tiny letters saying ‘Spam in the spam folder older than 7 days is deleted automatically.’

您可以通过访问设置»Akismet页面来查看操作中的更改。 向下滚动到页面底部,您会看到一条带有小写字母的注释,上面写着“超过7天的垃圾邮件文件夹中的垃圾邮件会被自动删除”。

Comment spam delete schedule shown in Akismet settings

It will replace 7 days with the number of days you used in your filter.

它将用您在过滤器中使用的天数代替7天。

Note: When spam comments are deleted, they are not sent to trash, so you cannot retrieve them back.

注意:删除垃圾评论后,它们不会发送到垃圾箱 ,因此您无法将其取回。

We hope this article helped you change Akismet spam comment delete schedule in WordPress. You may also want to see our guide on how to how to block spam comment bots in WordPress with honeypot.

我们希望本文能帮助您更改WordPress中的Akismet垃圾邮件评论删除时间表。 您可能还想查看我们的指南,了解如何使用honeypot阻止WordPress中的垃圾评论机器人

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-change-akismets-delete-spam-schedule-in-wordpress/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值