WordPress automatically transforms plain text posted in comments into a URL (Uniform Resource Locator). That way anyone can click the link and be taken to the web address. While convenient, bots can spam your WordPress comment section with URLs to low-quality, shady, or straight-up illegal web resources. This can tank your Google ranking rapidly and potentially ruin your website permanently. To remedy this, you can disable WordPress comments, which is what many do. A better choice is to learn how to disable URL auto-linking in WordPress comments. That way, comments remain, bots lose their effect, and visitors can still copy-paste the URL. Let’s begin.
1. Disable URL auto-linking in WordPress comments manually
This is by far the easiest way to disable URL auto-linking in WordPress comments. However, you’re editing core files, which some users are scared of. We don’t share that opinion, since comment links aren’t stored in the WordPress database. Adding URL links is something WordPress does on the fly, and this simply disables that filter. With that said, follow these steps to disable URL auto-linking in WordPress comments:
- Access your WordPress website via FTP.
- Go to the root/wp-content/themes/youractivetheme/ folder.
- Right-click on the functions.php file, then select View/Edit.
- When it opens, scroll down to the bottom and paste the following code:
remove_filter ('comment_text', 'make_clickable', 9);
- Save the changes. The updated file will replace the original.
- Verify changes were applied.
Things to keep in mind
Here are some facts you should know about this method:
1. It will disable URL auto-linking across your website
So, there’s no need to delete all WordPress comments or the old ones that threaten to devastate your website ranking.
2. It applies to your WordPress Dashboard
Don’t be surprised when you notice that the auto-linking of URLs is turned off throughout the WordPress Admin Section. It’s a big downside in terms of convenience, but a worthy trade-off.
3. Updating your WordPress theme might revert the change
This only applies to owners who aren’t using a child theme in WordPress. If you are one of those, utilize method 2, submethod 1 as a workaround.
4. This won’t disable HTML tags
Users can still use proper HTML tags to convert plain text into URLs. Use method 2, submethod 2, to solve this problem.
2. Disable URL auto-linking in comments via a plugin
The following methods are more resource-intensive, and can slightly slow your WordPress website down. However, they add the bonus functionality you might need. Let’s get into it.
1. Add a code snippet
Adding the aforementioned code in form of a code snippet ensures that it remains in place after you update your WordPress theme. The best way to do this involves creating a site-specific WordPress plugin yourself, which we’ll cover soon. Alternatively, you can install a WordPress plugin that enables this feature. A popular lightweight option is Code Snippets by Code Snippets Pro.
2. Use a dedicated WordPress plugin
The method above doesn’t disable HTML in WordPress comments. Bots and malicious users can still use appropriate HTML link tags to turn plain text into a URL. If you’re suffering the consequences of that, you can add a code in the functions.php file. Once again, we plan on covering this shortly. As an alternative, consider fixing the problem with a dedicated plugin. The easiest method includes disabling HTML within comments using Akismet, an anti-spam WordPress plugin you might already have. If don’t, or want a separate option, a popular choice is a Comment Link Remove plugin by QuantumCloud.