一个专注软件爱分享的网站

如何快速删除WordPress中所有待处理垃圾评论

最近出现历史评论中的网址出现危险异常的情况,这对于 WordPress 网站来说是一个噩梦,所以想要删除这些异常的评论链接。但是,如果评论太多,一个个去排查工作量太大,所以考虑删除评论中的网址字段,或者删除评论人链接。

您是否要在WordPress中删除许多待处理的注释? 如果您收到大量垃圾邮件评论,这很容易发生。

Normally, deleting comments in WordPress is easy, but it gets trickier when there is a large number of pending comments. You may even come across weird errors while bulk deleting comments if there are too many of them.

通常,在WordPress中删除评论很容易,但是当有大量待处理的评论时,它会变得更加棘手。 如果注释太多,则在批量删除注释时甚至可能会遇到怪异的错误。

In this article, we’ll show you how to easily bulk delete all pending comments in WordPress, step by step.

在本文中,我们将逐步向您展示如何轻松地批量删除WordPress中所有待处理的注释。

使用代码删除评论中的网址、邮箱、评论人链接

在 WordPress 网站提交评论时,需要选填“网址”这个表单,对于用户来说会觉得很麻烦,同时对于博主来说也会造成不安全的后遗症。其实完全可以移除网址表单,如果之前已经有一些评论包含了评论人网址,还可以直接移除。在主题的 functions.php 添加以下功能代码即可:

  1. //移除网址表单
  2. function url_filtered($fields)
  3. {
  4. if(isset($fields[‘url’]))
  5. unset($fields[‘url’]);
  6. return $fields;
  7. }
  8. add_filter(‘comment_form_default_fields’, ‘url_filtered’);
  9. // 移除邮箱地址
  10. add_filter(‘comment_form_defaults’,’remove_email’);
  11. function remove_email($comment_form_HTML_arr){
  12. //删除email文本框
  13. unset($comment_form_html_arr[‘fields’][’email’]);
  14. //修改评论提醒内容,去掉电子邮件相关的提醒。
  15. $comment_form_html_arr[‘comment_notes_before’] = ‘<p class=”comment-notes”>’.sprintf( ‘ ‘ . __( ‘Required fields are marked %s’ ), ‘<span class=”required”>*</span>’ ).'</p>’;
  16. return $comment_form_html_arr;
  17. //移除评论人名字的链接
  18. function disable_comment_author_links( $author_link ){
  19. return strip_tags( $author_link );
  20. }
  21. add_filter( ‘get_comment_author_link’, ‘disable_comment_author_links’ );

取消电子邮件时必填项

首先,在 wp 后台>>settings>>讨论>>讨论设置>>其他评论设置中,取消勾选“评论作者必须填入姓名和电子邮件地址”,如下图:
注:此方法只对使用 WordPress 默认评论表单的主题才有效,如果主题自定义过评论功能,是没办法生效的,只能靠自己修改主题的自定义评论文件。比如打开主题的 comments.php 文件,搜索 $comment_author_url 一般就可以定位到网址表单的代码。

使用插件删除评论中的网址、评论人链接

插件名称:Comment Link Remove

插件地址:https://wordpress.org/plugins/comment-link-remove/

如果您有数百条待处理的注释,那么我们建议您使用插件方法将其删除。

2.使用插件在WordPress中删除大量待处理的注释 (2. Deleting Large Number of Pending Comments in WordPress Using a Plugin)

The quickest way to delete a very large number of pending comments is to use a plugin.

删除大量待处理注释的最快方法是使用插件。

This will delete your pending (and spam) comments permanently. We recommend making a backup of your WordPress site before proceeding, just in case you change your mind later.

这将永久删除您的待处理(和垃圾邮件)评论。 我们建议您在继续操作之前备份WordPress网站 ,以防万一您以后改变主意。

First, you need to install and activate the Delete Pending Comments plugin. For more details, see our step by step guide on how to install a WordPress plugin.

首先,您需要安装并激活Delete Pending Comments插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, go to the Comments » Delete Pending Comments page in your WordPress admin. You will see a message letting you know how many pending comments there are.

激活后,转到WordPress管理员中的“ 注释”»“删除待处理注释”页面。 您将看到一条消息,让您知道有多少未决评论。

Note: This figure includes spam comments, which are deleted at the same time as the pending comments.

注意:此图包括垃圾评论,这些评论与待处理评论同时删除。

The Delete Pending Comments page in the WordPress admin

To delete all the pending comments, you need to type the required line of text into the box. You can copy and paste this text if you prefer.

要删除所有待处理的注释,您需要在框中键入所需的文本行。 您可以根据需要复制和粘贴此文本。

After that, go ahead and click the ‘Delete Pending Comments’ button.

之后,继续并点击“删除待处理评论”按钮。

You will then see a message confirming that all pending and spam comments have been deleted.

然后,您将看到一条消息,确认已删除所有待处理和垃圾邮件评论。

Message confirming that all pending and spam comments have been deleted

仅在WordPress中删除垃圾评论 (Deleting Spam Comments Only in WordPress)

What if you don’t want to delete pending comments but just want to delete the ones that are marked as spam? That’s very easy to do in WordPress.

如果您不想删除待处理的评论,而只想删除标记为垃圾邮件的评论该怎么办? 在WordPress中这很容易做到。

First, go to Comments in your WordPress admin and click on the Spam tab:

首先,在WordPress管理员中转到“评论”,然后单击“垃圾邮件”标签:

Click on the Spam tab to see a list of comments that have been marked as spam

Next, click the Empty Spam button. This will delete all spam comments permanently, not just the ones on the current page:

接下来,单击“清空垃圾邮件”按钮。 这将永久删除所有垃圾邮件评论,而不仅仅是当前页面上的那些评论:

Empty the spam to permanently delete all spam comments

We hope this article helped you learn how to delete all pending comments in WordPress. You may also want to see our WordPress security guide to protect your website, or see our guide on how to allow users to report inappropriate comments in WordPress.

我们希望本文能帮助您学习如何删除WordPress中所有待处理的注释。 您可能还希望查看我们的WordPress安全指南以保护您的网站,或者查看有关如何允许用户报告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.

赞(0) 打赏
本软件仅供个人学习测试使用,请再下载后24小时内删除,不得用于商业用途,否则后果自负,请支持购买正版软件。兔八哥爱分享-软件下载平台-绿色软件下载-破解软件免费下载 » 如何快速删除WordPress中所有待处理垃圾评论
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址