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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s