Disable URL/HTML in WordPress comments

Default WordPress comments box is allowed style and other HTML like URL link, you can disable without install any plugins for HTML or URL links in your WordPress comments box using code below.

HOW TO:
  1. Copy code below
  2. Paste to your functions.php  (Apearance >> Editor and Select Theme Functions)
CODE:


function plc_comment_post( $incoming_comment ) {

$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);

$incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );

return( $incoming_comment );
}

function plc_comment_display( $comment_to_display ) {

$comment_to_display = str_replace( ''', "'", $comment_to_display );

return $comment_to_display;
}

add_filter( 'preprocess_comment', 'plc_comment_post', '', 1 );
add_filter( 'comment_text', 'plc_comment_display', '', 1 );
add_filter( 'comment_text_rss', 'plc_comment_display', '', 1 );
add_filter( 'comment_excerpt', 'plc_comment_display', '', 1 );
remove_filter( 'comment_text', 'make_clickable', 9 );