AWeber (Autoresponder)
Brian Tracy Self Help
This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies. Find out more.

How to Remove All WordPress HTML Comment Tags

 Posted by  Add comments

How to Remove All WordPress HTML Comment Tags

HTML Graphic

By default, WordPress allows commentators to use a restricted set of HTML tags in comment, quote and/or format text. In most blogs this "feature" is rarely if ever used but does leave the site open to "spam" links.

In such cases we might be better off removing the HTML tag feature altogether and let commentators use only plain text.

To prevent the use of HTML tags in comments, paste the following code into the functions.php file:

add_filter('comment_text', 'wp_filter_nohtml_kses');

add_filter('comment_text_rss', 'wp_filter_nohtml_kses');

add_filter('comment_excerpt', 'wp_filter_nohtml_kses');

The code applies the WordPress built-in function ‘wp_filter_nohtml_kses‘ to the filters, ‘comment_text’, ‘comment_text_rss’ and ‘comment_excerpt’ used to display comments and strips all HTML tags.

Because this method uses only built-in WordPress core functions, it’s nice and safe and fast!


KingSolutions.org.uk is hosted on JustHost

 Leave a Reply



184 queries in 0.875 seconds (Child).