How to Remove HTML Allowed Tags in WordPress Comment Section

WordPress introduced HTML allowed tags in comment form since WordPress 3.0. This is the text you will see after the comment box that reads:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

We’ve seen lots of people were asking whether it’s possible to remove them. In this article, we’ll show you how to remove HTML allowed tags using three different ways:

1. Using Filter

You may use the following code to remove the HTML allowed tags text in your site. The code should be in functions.php of your child theme.

1 2 3 4 5 6 7 8 9 10 11 12
<?php
/*
* Remove HTML allowed tags in WordPress
* @Link http://wp.me/p33UjS-EC
*/
add_filter( 'comment_form_defaults', 'afn_custom_comment_form' );
function afn_custom_comment_form($fields) {
$fields['comment_notes_after'] = ''; //Removes Form Allowed Tags Box
return $fields;
}
view raw functions.php hosted with ❤ by GitHub

2. CSS

If you’re afraid of editing functions.php file, there’s an alternative. The HTML allowed tags form can be hide using a simple CSS code. Open up your style.css file and drop the code below:

1 2 3 4 5 6
// Remove HTML allowed tags in WordPress
// Link: http://wp.me/p33UjS-EC
 
.form-allowed-tags {
display: none;
}
view raw style.css hosted with ❤ by GitHub

3. Using Remove Comment Notes plugin

If really have no idea how to use any of the code below, there’s a plugin for this. All you need to do is to install and activate Remove Comment Notes plugin. Just activate the plugin and you are ready to go, no additional configuration is need.

Comments

Leave a Reply

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