WordPress – Disable HTML in comment

WordPress – Disable HTML in comment

How we can disable HTML tag on WordPress comment using Hook. If HTML tags are enabled Hackers enter javascript code on the comment and hack the WordPress. If you are used the WordPress for blogging you must disable the HTML code from the comment after installing the WordPress.

Let’s see how we can disable the HMTL code from the comment. Let’s write the filter on  functions.php file of your active theme.

add_filter( 'pre_comment_content', 'esc_html' );

After adding above hook on your functions.php file The HTML code are disable form the comment.

If you face any issue after using above hook write the comment below.