If you are dealing with many spam comments, this tutorial will help you to discourage users who are trying to add their website links in their comments.
Disable HTML for New Comments
This is a tiny code to prevent your WordPress website users from adding HTML tags in their comments. After adding this snippet into the functions.php file in your WordPress theme, all HTML tags will be stripped out from new comments.
function btt_disable_html_in_new_comments() { global $allowedtags; $allowedtags = array(); } btt_disable_html_in_new_comments();
Note: Above code will not effect existing comments in your blog.
Remove HTML from Existing/New Comments
If you want completely strip HTML from all comments on your website, you the code given below in functions.php:
function btt_strip_html_in_comments($comment) { return strip_tags($comment, ''); } add_filter('get_comment_text', 'btt_strip_html_in_comments');