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();

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

File Under : comments, wordpress

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.