How to Remove All Links in WordPress Comments

By Updated   BloggingSEOWordPress

How can you remove spam links from your WordPress comments text? If you get thousands of spam comments everyday, even with anti-spam comment tools,  there is a chance that many spam comments were able to get posted and had malicious links to spam websites. Editing thousands of comments is a tedious task.

As link removal requests get more common due to multiple Google penalties and webmasters find bad links pointing from your site, there is a high chance they will request link removal or add your site to the disavow tool.

I always wanted a way to bulk remove such links from all my WordPress comments … and I just did this with a single line of code.

WordPress Makes Links Clickable

For example, lets see this link posted in a comment. [Please note this particular comment is shown as an example only and the comment link is not spam]

clickable link

If you actually see the comment in the Edit screen, there was no clickable complete url.

Edit Link

In fact it is a cool feature of WordPress that makes a text link clickable in this comment.

Removing Comment Links

So here is what I did. I added this single line of code to the theme functions.php file. [Be careful when you edit this important file in your themes editor, as wrong edits can take your blog offline – keep a backup and restore via FTP if needed]

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

This disables the ability of WordPress to makes all these links clickable in the comments text. And now when you see the same comments after using this code, you see the clickable links are gone!

text link

NOTE: This will affect remove ALL links (spam and not spam) in comments text only (not comment author links)  on your whole blog. The links will become non clickable, but would stay as text links. This would mean effectively thousands of published spam links will disappear instantly! Try it.


8 comments on “How to Remove All Links in WordPress Comments

  1. Sameer Suri says:

    Very nice tip indeed

  2. Bilal Akbar says:

    A sure way to tackle the spammers. Thanks for this handy tip.

  3. Dean Saliba says:

    I charge people for removing their links. They paid someone to spam my blog so why should I clear up their mess for free? And this “threatening me with Disavow” nonsense needs to stop as well, having your site submitted to this tool WILL NOT hurt your site.

  4. balukabela says:

    I really searching the answers about prevent spamming comments in wordpress for some days because my wordpress blog attack with lots of spamming comments everyday. I used plugins but they are not so active. Now I have found the easiest way to remove spamming comments.

  5. Nina says:

    Great info. Thanks a lot for sharing the Disavow tool.

  6. spookseo says:

    Links are way too dangerous because you just cannot get into others’ profiles if you are planning to flag them it. They are form of advertisements that looks really suspicious. Spams are everywhere now. If you just do not know how to control them, then, your site is really doomed.

  7. Trivedi Jay says:

    Nice tips and trick for remove spam links in WordPress Comments..

    Thanks Admin for sharing this article

    Have a nice day

  8. sayupatil says:

    Thanks for the nice tip.

Leave a Reply

Your email address will not be published. Required fields are marked *




css.php