Removing the allowed HTML tags and attributes note after the comment form in WordPress

⚠️ Code snippets might not be compatible with the latest version of your theme. Always use a child theme to customize your theme, and test your code on a staging website before migrating to production.

Those last days I have had a recurrring request on how to remove the text describing the HTML tags allowed in comments : “You may use these HTML tags and attributes …“.

removing-text-below-comment

 

 

This is pretty simple to remove this note in WordPress since it is declared in an array assigned to a hook. You just need to hook in the ‘comment_form_default_fields’ array and set your desired custom value or just an empty string.

Check the source code here.

The Html tag text is declared with the comment_note_after key of the array(). That’s the one that will be modified in the following code snippet.

add_filter('comment_form_defaults' , 'remove_allowed_html_tags_note', 30);
function remove_allowed_html_tags_note( $defaults ) {
	//returns the modified array
	return array_replace( $defaults, array('comment_notes_after' => '' ) );
}

This code has to be pasted in your functions.php. More about customizing your WordPress theme.

Leave a comment

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

33 thoughts on “Removing the allowed HTML tags and attributes note after the comment form in WordPress”