When I first started my WordPress website, I had no idea that the comment section could turn into a link farm.
By default, WordPress automatically turns any URLs in comments into clickable links. While this can be helpful sometimes, it can also lead to a cluttered comment section, unwanted spam links, and a less-than-ideal user experience.
If you think about it, someone leaves a thoughtful comment, but then a long, ugly URL gets automatically linked, making the comment look messy. Or worse, spammers sneak in comment links that you’d rather not have on your site. That why it is important to prevent auto-linking URLs in comments.
In this article, I’ll show you how to disable auto linking of URLs in WordPress comments using a very simple method.
Why Disable Auto Linking in WordPress Comments?
Adding links to comments can be helpful in many situations. Users can link useful guides on your site and provide more context to their comment.
However, there are situations where disabling auto linking in comments is essential. Let’s see why you’d want to consider this:
- Knock Down Comment Spam: Spammers love to drop links in comments, hoping to boost their own sites or worse. While disabling auto-linking won’t magically stop all spam, it makes those spammy links less effective and less visually prominent, as they won’t be clickable right away. You’ll still need comment moderation, but it’s an extra layer of defense.
- Clean Up Comment Aesthetics: Long URLs can be an annoying distraction in your comment section. Disabling auto-linking helps keep your comments looking clean and focused on the actual conversation, not a jumble of links.
- Prevent Accidental Links: Sometimes users might type something that looks like a URL but isn’t intended to be a link. Disabling auto-linking prevents these accidental links from popping up and potentially confusing other readers.
- Boost Your Comment Moderation Power: Want to have the final say on what gets linked in your comments? Disabling auto-linking gives you that power. You can then manually decide if and when a link is appropriate to add.
That said, let’s see how you can easily disable auto linking URLs in the comments section.
Disable Auto Linking URLs in WordPress Comments
The easiest way to disable URL auto linking in WordPress comments is by using WPCode. It helps add a tiny snippet of code to your site’s functions.php file without the risk of breaking anything.
The best part is that WPCode is designed for adding code snippets to WordPress safely. You won’t need to mess with your theme files directly (which can be risky), and you can manage all your code snippets in one place.
Note: For this tutorial, we will use the WPCode Lite version, which is available for free. There is also a WPCode Pro version that offers more features like code revisions, AI snippet generator, eCommerce integrations, and more.
To start, you can go to Plugins » Add New Plugin from the WordPress admin panel and search for ‘WPCode’ in the search bar.

From here, simply click the ‘Install now’ button and then activate the plugin. Need help with this? Then please see this guide on how to install a WordPress plugin.
Once the plugin is active, you will need to connect the WPCode Library with your WordPress site. The library contains over 140+ verified snippets from experts that will help add custom features to your website.
Simply head to Code Snippets » Settings from the admin panel and click the ‘Connect to the WPCode Library’ button under the ‘General Settings’ tab.

After that, you’ll see a new popup window.
Go ahead and click the ‘Connect to WordPress’ button.

You’ve now successfully added the snippet library to add a custom snippet for disabling auto linking in the comments section.
Next, you can go to the Code Snippets » Add Snippet page from the WordPress dashboard.
Here, you’ll need to the Comments tab or search for the ‘Disable Comment URL Linking’ snippet. From here, simply hover over the snippet and click the ‘Use snippet’ button.

On the next screen, you’ll see the snippet already preloaded in the code editor.
Besides that, WPCode will also automatically configure all the settings to run the code on your site.

Next, you can scroll down to the Insertion section. This is where you can choose where you’d like to insert the code.
The best part about using WPCode is that it handles everything, and you can use the default settings. For running the disable comment URL linking snippet, the code snippet plugin set it to Auto Insert and Run Everywhere on your site.

After that, you can scroll to the top and click the toggle to make the snippet Active.
From here, simply click the ‘Update’ button.

That’s it! You’ve successfully disabled auto linking URLs in WordPress comments.
To check if the snippet is working, try leaving a comment with a URL. It should automatically disable linking, and the URL should appear in plain text. Here’s an example of how it should appear:

I hope this article helped you learn how to disable auto linking URLs in WordPress comments. You may also want to see our guide on how to add a scroll to the top button in WordPress and how to add a dynamic copyright date in WordPress footer.
If you need help, then feel free to leave a comment below. And don’t forget to follow us on X (formerly known as Twitter) and subscribe to our newsletter for all the latest updates.