How To Disable HTML in WordPress Comments

If you don’t want users to post HTML in comments on your site, you can post the code below into your WordPress theme’s functions.php file:


/* Disable Hyperlinks in WordPress Comments */
remove_filter('comment_text', 'make_clickable', 9);
add_filter('pre_comment_content', 'strip_comment_links');

function strip_comment_links($content) {

global $allowedtags;

$tags = $allowedtags;
unset($tags['a']);
$content = addslashes(wp_kses(stripslashes($content), $tags));

return $content;
}

Other Helpful Articles

How To Disable HTML in WordPress Comments

If you don’t want users to post HTML in comments on your site, you can post the code below into your WordPress theme’s functions.php file: /* Disable Hyperlinks in WordPress Comments */ remove_filter(‘comment_text’, ‘make_clickable’, 9); add_filter(‘pre_comment_content’, ‘strip_comment_links’); function strip_comment_links($content) { global $allowedtags; $tags = $allowedtags; unset($tags[’a’]); $content = addslashes(wp_kses(stripslashes($content), $tags));

Read More »

What Do You Need Done?:

(Please check all that apply)

Tell Us About You

Almost Done!

Let's Get Some Info

Let's Get Some Info

Let's Get Some Info

Let's Get Some Info

Let's Get Some Info