
网址 WordPress
您是否知道,当用户在评论中添加纯文本 URL 时,WordPress 会自动使其可点击。最近,我们的一位读者问我们是否可以禁用 WordPress 评论中文本 URL 的自动链接?答案是肯定的。在本文中,我们将向您展示如何禁用 WordPress 评论中的 URL 自动链接。
您是否知道,当用户在评论中添加纯文本 URL 时,WordPress 会自动使其可点击。最近,有读者问我们是否可以禁用WordPress评论中文本URL的自动链接?答案是肯定的。在本文中,我们将向您展示如何禁用 WordPress 评论中 URL 的自动链接。
为什么WordPress自动链接评论中的文本URL? (Why WordPress Autolinks Text URLs in Comments?)
WordPress 会自动将文本 URL 转换为链接,以便在审核评论时更轻松地访问链接。
WordPress 会自动将文本 URL 转换为链接,这样在审核评论时可以更轻松地访问链接。
This auto-linking is not stored in your database. WordPress makes URLs clickable when displaying them on screen in 管理区 as well as comments section below your articles.
此自动链接未存储在数据库中。 当在管理区以及文章下方的评论部分中显示它们时,WordPress使URL可单击。

其中一些评论是真实的,但评论者不知道如何在评论中添加链接。但许多垃圾评论还包含直接粘贴在评论文本中的纯 URL。
其中一些评论是真实的,但评论者不知道如何在评论中添加链接。然而,许多垃圾评论还包含直接粘贴到评论文本中的纯 URL。
在WordPress注释中禁用自动链接 (Disabling Auto-Link in WordPress Comments)
Simply add this single line of code in your theme’s 函数.php file or in a 特定于站点的插件.
只需将这一行代码添加到主题的函数.php文件或具体的于在网站的插件中 。
remove_filter( 'comment_text', 'make_clickable', 9 );
WordPress does not store plain text URLs as links in the 数据库. Instead it changes them into clickable links on the fly. This code simply disables the filter that makes URLs clickable.
WordPress不会将纯文本URL作为链接存储在在数据库中 。 而是将它们动态更改为可点击的链接。 此代码仅禁用使URL可单击的过滤器。
这使得纯文本 URL 在管理区域和帖子下方的评论部分中不可点击。删除此代码将重新启用自动链接。
这将使纯文本 URL 在帖子下方的管理区域和评论部分中不可点击。删除此代码将重新启用自动链接。
如果您将其添加到主题的functions.php文件中,那么更新主题将覆盖您的函数文件。
如果将其添加到主题的functions.php 文件中,更新主题将覆盖函数文件。
另请记住,此代码仅适用于纯文本 URL。如果用户决定通过添加适当的 HTML 标签来创建链接,那么这些链接将按其应有的方式显示。
另请记住,此代码仅适用于纯文本 URL。如果用户决定通过添加适当的 HTML 标签来创建链接,这些链接将按原样显示。
If you want to complete turn off any HTML in comments, then take a look at our tutorial on how to 禁用 WordPress 评论中的 HTML.
如果要完成关闭注释中的所有HTML,请查看我们的有关如何禁用 WordPress 评论中的 HTML教程。
We hope this article helped you disable auto linking of URLs in WordPress comments. You may also want to see our list of 16 个改善 WordPress 评论的最佳插件.
我们希望本文能帮助您禁用WordPress注释中URL的自动链接。 您可能还希望查看我们的16 个最佳插件列表, 改善 WordPress 评论 。
If you liked this article, then please subscribe to our YouTube 频道 for WordPress video tutorials. You can also find us on 推特 and Facebook.
如果您喜欢这篇文章,请订阅我们的YouTube 频道 WordPress视频教程。 您也可以在推特和Facebook上找到我们。
翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-disable-auto-linking-of-urls-in-wordpress-comments/
网址 WordPress