How to Remove Links in Comments Content Without Using Plugin [WordPress]

When I read the comments posted on articles, I do find the links in comment content. The link says, you can find more info about this topic at this web url and bla bla nad that web url is click-able. For example, I comment on a WordPress blog and I just put the text as http://www.clickonf5.org/ as a reference site in the comment text. Note that I have not written the html to make it the link. But when the comment gets displayed on the post, this text automatically becomes a link which is clickable.

[ad id=’7′ style=’float:left;margin:10px 10px 10px 0′]So the point is these links are clickable (anchor html elements), though usually those are nofollow. Sometimes the links are really useful to our readers but sometimes those are spam or just promotion of some article. As they are clickable, they can mislead our readers to click them and go off topic. In fact, I once got a comment with a good feedback but was containing a link that directed me to a web page that had a malware.

If you have kept your blogs comment (discussion) setting to auto approve the comments, this would be a major problem which you would be facing. So why not make such kind of web address text posted in comment content non-clickable, just a plain text url.

In order to remove such auto links in comment content, you do not actually need any WordPress plugin. You just need to add one line in your active theme’s functions.php. Copy the below one line of code and paste it as it is in your Theme Functions file.

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

You can find the Theme Functions file on your WordPress Admin Dashboard => Appearance => Editor => On the right hand side you can see the theme template files. Locate the Theme Functions file, add the line and save it. Now check all the comments, you will find all such text that represents a web address is just a text now and not a clickable link.

In case you do not have access to Theme Editor on dashboard, you can always use the FTP client to get the file, edit it and then upload to the server.