9.4 C
New York
Thursday, April 18, 2024

Disable HTML tags and automatic links in WordPress comments

Manage SPAM comments with WordPress
A blog can be a powerful means of information and study and at the same time a spam receptacle , depending on the “people” who visit it and who manages it. You will surely have ended up in a blog that does not moderate comments and does not care about interactions with users, the result is an invasion of SPAM and low quality links inserted in the comments. This aspect is certainly not good for the image of the blog.
Thankfully there are ways to mitigate this phenomenon in WordPress. First there is Akismet, a free anti-SPAM service that validates comments before posting them on the front-end. Then there are the native WordPress settings for handling comments:
Discussion Settings – Manage comment options in WordPress
With these options you can slightly modify the blog policies so that you can block some spam comments. Unfortunately in most cases these options are not sufficient to solve or at least buffer the problem.
Also, by default, WordPress comments allow certain HTML tags to be used within the comment body. Using them can help format comments better, but in practice spammers use this feature to insert malicious backlinks .
HTML tags that can be used in WordPress comments:
Did you know that when a user adds a plain text URL in your comments, WordPress automatically makes it clickable? The automatic link is not stored in the database. WordPress makes URLs clickable when they are displayed on the screen in the admin area and in the comments section below your posts.
Finding comments full of spam links is not only annoying, it can also ruin the SEO of the page or even the entire site. Better to avoid.
The best solution in my opinion is to completely disable HTML tags in comments , which means that the user will not be able to use the markup, WordPress ignores any tags and does not convert the text to HTML.
There are no settings in the dashboard to accomplish this, so you’ll need to add a line of code to your functions.php file:
I also recommend disabling the automatic transformation of URLs into clickable links . You can do this by adding another line:
Note that this code only works on plain text URLs. If a user has decided to create a link by adding the correct HTML tag and you haven’t disabled HTML markup , those links will display as they should.
Not sure how to add the line in functions.php file? Then better if you use a plugin already done .
From now on, comments will only be able to post plain text . Maybe it’s not the best, but much safer than the alternative of getting flooded with spam and having to delete all comments at once .

Uneeb Khan
Uneeb Khan
Uneeb Khan CEO at blogili.com. Have 4 years of experience in the websites field. Uneeb Khan is the premier and most trustworthy informer for technology, telecom, business, auto news, games review in World.

Related Articles

Stay Connected

0FansLike
3,912FollowersFollow
0SubscribersSubscribe

Latest Articles