Allow More HTML Tags or Change Them In WordPress Comments Area, And Show It In allowed_tags()
This simple code will allow you to add more HTML tags in your comments area. Plus, they will display under the message field, if you are using allowed_tags() in your theme.
Put this code into your theme’s functions.php file.
If you want to change the tags or add more, you can do it by simply pushing more to $allowedtags variable. Check wp-includes/kses.php file for calling tags.// Show the tags if the comments are allowed in post/page add_filter('comments_open','eg_allow_tags_in_comments'); // For making it sure, we also force the tags again before comment approval add_filter('pre_comment_approved','eg_allow_tags_in_comments'); function eg_allow_tags_in_comments($data) { // This variable is in wp-includes/kses.php file, check it out global $allowedtags; // You can add HTML tags and their properties by this way // Don't force too much, there is a reason they are not allowed $allowedtags['span'] = array('style'=>array()); $allowedtags['li'] = array(); $allowedtags['ol'] = array(); // And we return our expanded data for comment approval return $data; }















