How to Remove HTML from WordPress Comments

Posted by Lasantha Bandara on August 2nd, 2017 File Under : comments, wordpress0 Comment

This is little code to prevent your WordPress website users from adding HTML tags in their comments. If you are dealing with many spam comments this will discourage users who are trying to add their website links. After adding this snippet into the functions.php file in your site, all HTML tags will be stripped out from new comments.

function btt_disable_html_in_comments()
{
    global $allowedtags;
    $allowedtags = array();
}
btt_disable_html_in_comments();

Note: This will not effect existing comments in your blog.

File Under : comments, wordpress

Leave a Reply