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

Why Does WordPress Autolink Text URLs in Comments?

WordPress autolinks text URLs in comments to make them easier to click. 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:

  1. Installing a WordPress Plugin to Disable URL Auto-Links
  2. Disabling Auto-Links of URLs in WordPress Comments
    1. FAQs: Disabling URL Auto-Linking in WordPress Comments

      Easy, right? Let’s jump right in!

      Before we start, do note that 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.

      However, we don’t recommend this method as it’s not really beginner-friendly. One tiny mistake, and your site might stop working.

      To do this easily and safely, you can use WPCode, which is the best code snippet plugin on the market. With WPCode, you can add custom code snippets, including CSS, PHP, HTML, and more, to WordPress without putting your site at risk.

      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.

      The best news is that WPCode comes with a library of 100+ ready-made snippets that you can easily add to your site. This includes a code snippet for disabling comment URL linking.

      Since it’s a premium feature, you’ll need to create a WPCode account. On the WPCode website, go ahead and click the ‘Get WPCode Now’ button.

      Then, you can simply choose a plan and complete the sign-up process.

      WPCode's homepage

      Once done, let’s install and activate the WPCode plugin on your WordPress 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, you’ll want to use the ‘Comments’ filter to easily 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.’

      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 works on plain text URLs. If a user decides to create a link by adding the proper HTML tag, 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’re 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.

      This risk of losing your customizations during a theme update 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

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

      No, this change only applies going forward.

      It stops WordPress from automatically converting plain text URLs into clickable links in any new comments you get. Links that were already in your older comments will remain clickable unless you decide to edit them manually.

      Can users still add their own links in comments?

      Yes. This code only disables the automatic conversion of text URLs. If a commenter knows how to create a link using the proper HTML tag, 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.