How to Remove All WordPress HTML Comment Tags
How to Remove All WordPress HTML Comment Tags

By default, WordPress allows commentators to use a restricted set of HTML tags in comment, quote and/or format text. In most blogs this "feature" is rarely if ever used but does leave the site open to "spam" links.
In such cases we might be better off removing the HTML tag feature altogether and let commentators use only plain text.
To prevent the use of HTML tags in comments, paste the following code into the functions.php file:
add_filter('comment_text', 'wp_filter_nohtml_kses');
add_filter('comment_text_rss', 'wp_filter_nohtml_kses');
add_filter('comment_excerpt', 'wp_filter_nohtml_kses');
The code applies the WordPress built-in function ‘wp_filter_nohtml_kses‘ to the filters, ‘comment_text’, ‘comment_text_rss’ and ‘comment_excerpt’ used to display comments and strips all HTML tags.
Because this method uses only built-in WordPress core functions, it’s nice and safe and fast!



