skip to Main Content
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.


I am a web designer and developer part-time blogger. Write something on some free time. Find my every day thought here :)

Leave a Reply

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

Back To Top