How To Disable HTML Tags In WordPress Comments

By October 1, 2017 Html, WordPress No Comments
WPBEGINNER» BLOG» TUTORIALS» HOW TO DISABLE HTML IN WORDPRESS COMMENTS How to Disable HTML in WordPress Comments

How To Disable HTML Tags and links In WordPress Comments?

If you’re are running a WordPress Site and allowing your visitors to comment on your articles, you have surly faced the problem of spamming on your blog post.  By default setting of WordPress allow user to able to use some HTML tags to style their comments.

User can comment HTML tag to make words bold, italic or they will add links into your comments.

If you observe a lot of SPAM comments comes on your article that may contain these tags. Mostly  spam comments are generated via bots and scripts, which contenting HTML tags with links and script. This comments are not relevant to your article and doesn’t make any sense.

You can solve this issue by disabling HTML Tags In WordPress Comments. Here i am showing you the way How you can Disable HTML Tags In WordPress Comments.

Solution 1:

Add following snippet to your theme’s functions.php file:

Solution 2:

  1. Open functions.php file
  2. Copy and paste the following snippet:

This above 2 code snippets will only disable HTML tags. So someone you are able to post special char like :

< a> < em> < strong>

Solution 3:

If you want to remove only link tag from comment data, and allow other tag like b, span, etc than you can use this code snippets.

This removed the ability for users to post links within comments:

Conclusion

I hope the above solution definitely works for you, and if you find any query or have the way other than this then do share it in the comment section. And please  share your thoughts about the post and how much you find it helpful to you. 🙂


[paypal-donation]

About Vijay Dhanvai

A passionate blogger by heart and mind, I have been working in this field for 10 years now. A WordPress Professional, web developer and designer who intends to guide his readers about Web Design, WordPress, Blogging, Web Development, and more.

Leave a Reply