By default, WordPress allows certain HTML tags in comments, like <a>, <em>, and <strong>. Unfortunately, a lot of spam comments also use these tags. Most of these spam comments are created by bots and scripts that rely on HTML tags. Disabling HTML in WordPress comments can help reduce spam. This guide will show you how to disable HTML tags in WordPress comments.
This method will disable active HTML tags. For example, if someone posts:
html
Using a Plugin Instead
If you don’t want to manually add this code, there is a plugin available that does the same job. You can install and activate the “Peter’s Literal Comments” plugin.
This method is preferable because it doesn’t require changes to the core WordPress files. If you do want to edit core files, you can modify the wp-includes/kses.php
file, but this is not recommended.