Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Disable Auto Linking of URLs in WordPress Comments

A WordPress comment section full of random clickable links can make your website look suspicious.

For many site owners, that’s where the trouble starts. Spammers abuse it, search engines may flag it, and even genuine comments with useful links can end up looking suspicious.

At WPBeginner, we usually mark these comments as spam, but we know that’s not the best solution for everyone.

After thorough research, we’ve found a simple way to block auto-linking of URLs while keeping real conversations flowing. 💬

In this guide, we’ll show you how to disable automatic URL linking in WordPress comments. This way, you have more control over your comment section while still encouraging meaningful engagement.

Disabling auto-linking of URLs

🧑‍💻 TL;DR: The easiest way to disable auto-linking of URLs in WordPress comments is by using the WPCode plugin and activating its pre-made ‘Disable Comment URL Linking’ snippet.

Why Does WordPress Autolink Text URLs in Comments?

WordPress autolinks text URLs in comments as a built-in, helpful core feature to make them easier to click and improve usability for genuine conversations. This is meant as a convenience feature, so site owners and readers can visit links without copying and pasting.

Sometimes, these links are added by genuine commenters who don’t know how to format a hyperlink.

WordPress simply detects the URL and makes it clickable when showing the comment in the admin area or under your articles. Plus, it’s not actually stored that way in your database.

Text URLs auto-linked in WordPress

The problem is, spammers abuse this to drop shady links in your comments. This can make your WordPress website look untrustworthy to both readers and search engines.

That’s why many site owners prefer to disable auto-linking.

With that in mind, we will show you how to disable auto-links of URLs in WordPress comments. Here are the steps you’ll take:

Easy, right? Let’s jump right in!

While many WordPress experts will tell you to add a custom line of code to your theme’s functions.php file or in a site-specific plugin, there is a much better way.

Using WPCode, the best code snippet plugin on the market, is a safe and easy way to add code to your website. It allows you to add custom snippets like CSS, PHP, and HTML without editing your theme files, preventing small mistakes that could break your site.

Some of our partner brands use WPCode to create and manage custom code snippets, and it’s been working really well.

Don’t miss our detailed WPCode review to learn why we strongly recommend it.

To start, you’ll need to create a WPCode account. On the WPCode website, click the ‘Get WPCode Now’ button, choose a plan, and complete the sign-up process.

WPCode's homepage

📌 Note: WPCode Pro comes with a library of 100+ ready-made snippets that you can easily add to your site, including a code snippet for disabling comment URL linking. That said, you can also start with the free WPCode version before upgrading.

Upon signup, you’ll have your own WPCode account area, where you can download your plugin’s zip file and access your license key.

Now, let’s install and activate the WPCode plugin on your site.

Navigate to Plugins » Add Plugin in your WordPress admin area.

The Add Plugin submenu under Plugins in the WordPress admin area

On the next screen, click the ‘Upload Plugin’ button.

After that, you can click ‘Choose File’ to upload your WPCode zip file from your local computer.

Choose File button to upload a plugin's zip file

Hit ‘Install Now’ when it finishes uploading and then ‘Activate’ to enable it on your site. If you need help, then you can refer to our guide on how to install a WordPress plugin.

Upon activation, you’ll need to activate your license key.

To do this, you’ll navigate to Code Snippets » Settings.

Next, under the ‘General Settings’ tab, simply enter your license key and click ‘Verify Key.’ You can find this key in the email you receive after registration or in your WPCode account.

Activating WPCode license key

The next step is to go to Code Snippets » + Add Snippets from your WordPress admin dashboard.

From here, use the ‘Comments’ filter to quickly find the ‘Disable Comment URL Linking’ snippet. Then, you can hover over the snippet and click on the ‘Connect to library to unlock (Free)’ button.

Connecting the WPCode plugin to WPCode Library

On the popup that appears, go ahead and click ‘Connect to WordPress’ to securely sync your website to the free WPCode cloud library to fetch the snippet.

Once connected, you should then be ready to use the ‘Disable Comment URL Linking’ snippet. So, let’s hover over it again and click ‘Use snippet’ when it appears.

Use Disable Comment URL Linking snippet

This will redirect you to the WPCode code editor.

Since the code snippet is ready to use, you just need to switch the toggle from ‘Inactive’ to ‘Active’ and click the ‘Save Snippet’ button.

Activate and save the Disable Comment URL Linking snippet

⚠️ Important: Please note that this code only prevents plain text URLs (like www.example.com) from becoming clickable. It does not disable HTML rendering.

If a user decides to create a link by adding the proper HTML tag (such as <a href=”http://www.example.com”>my link</a>), then those links will still appear clickable.

If you want to completely turn off any HTML in comments, then you can take a look at our tutorial on how to disable HTML in WordPress comments.

And that’s it – your WordPress blog will now stop auto-linking URLs in comments.

Here’s what it looks like on our demo site:

Auto linking of URLs in comments disabled

Bonus: Explaining the Code Snippet to Disable Auto-Linking in Comments

If you just wanted to fix the issue, you are all done! But if you love learning how WordPress works behind the scenes and are curious, here’s the code snippet we used for disabling auto-links of URLs in WordPress comments:

remove_filter( 'comment_text', 'make_clickable', 9 );

This snippet works because WordPress doesn’t store URLs as clickable links in its database.

Instead, it converts plain text URLs into clickable links on the fly when displaying comments.

By disabling the filter responsible for this, you stop URLs from automatically becoming clickable. This change will affect both the admin area and the comments section below your posts.

If you remove the snippet later, WordPress will start auto-linking URLs again. If you were to add this code directly to your theme’s functions.php file instead, you would risk losing your changes the next time you update your theme.

This is exactly why we recommend using a plugin like WPCode. It stores your snippets separately from your theme files, so you never have to worry about updates breaking your site’s custom features.

FAQs: Disabling URL Auto-Linking in WordPress Comments

Here are a few of the most common questions our readers ask about disabling automatic URL links in WordPress comments.

Will disabling auto-linking remove links from my existing comments?

Yes, because WordPress generates these links on the fly when loading the page, disabling the feature will instantly turn plain text URLs in older comments back into normal, unclickable text.

It stops WordPress from automatically converting plain text URLs into clickable links across all comments, both new and old. You will not need to edit older comments manually, as the automatic links will be removed instantly.

Can users still add their own links in comments?

Yes. This code only disables the automatic conversion of text URLs, but it does not disable HTML. If a commenter knows how to create a link using the proper HTML tag (like <a href=”http://www.example.com”>my link</a>), that link will still appear in their comment.

Is this change reversible?

Yes, it is completely reversible. If you use the WPCode plugin as we recommend, you can simply toggle the snippet to ‘Inactive’ and save your changes. WordPress will immediately go back to auto-linking URLs.

Does this snippet affect links in my blog posts or pages?

Not at all. The code snippet we use is designed to target only the comments filter. It will have no effect on how links work inside your post or page content.

Further Reading: More Ways to Improve Your WordPress Comments

We hope this article helped you disable the auto-linking of URLs in WordPress comments.

If you want to improve your WordPress comments even more, check out these additional tutorials for more tips and tricks:

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

22 CommentsLeave a Reply

  1. Thanks for the guide. I added the code to function.php and it worked. So is there a way to exclude my own links from this?

    • We do not have a simple way at the moment but should we find a way we would recommend we will be sure to update the article!

      Admin

  2. Thanks, this was helpful. I was getting a lot of comments like ‘your website is great…bla bla…check mine’ and a link. Hopefully this will fix it

  3. Hello How can i disable auto link in posts not comments
    when i enter a link in text format ex: http://www.example.com it is automatically changed to hyperlink when i publish post how can i disable this thanks

  4. Hello. I’m looking for a way to do just what you mentioned, but only for posts. It seems with a recent WP update, if you type a website address in a post, WP will automatically link to it. For example, if your post contains “google.com” somewhere in the post, then WP will add a link to google. Can we stop that from happening? If so, how? Thank you

    • Hey Sebastien did you find the solution for your problem as i am also having problem with this.. and i just want to get it disabled.. thanks

  5. Could the functions.php in a child theme be used to add ‘remove_filter( ‘comment_text’, ‘make_clickable’, 9 );’ to the theme rather than making changes directly to the theme?

  6. That is really good. In my case, I’ll make a conditional to make my links – as admin – clickable, since I post them on replies to comments.

    Thanks :)

    • Hi Angel,
      do you mind posting here the code you wrote? I’m interested in having my own links (as admin) cliackable ;)

      Thank you

      • As I am the only person show logs in I am able to use:
        if ( is_user_logged_in() ) {
        remove_filter( ‘comment_text’, ‘make_clickable’, 9 );
        }

    • Maybe I’m wrong about your situation, but you should not write in your Blog with an Admin User. The “Writer” should have a lower role (editor for example) and have another user with the Admin role for admin stuff.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.