emrahgunduz
always eats his vegetables
Blog RSS Feed
  • twitter
  • friendfeed
  • linkedin
  • facebook
  • vimeo
  • flickr
  • lastfm
Allow More HTML Tags or Change Them In WordPress Comments Area, And Show It In allowed_tags()

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.

// 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; }
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.

This post's short url is: http://emrg.me/6o

Calendar

May 2012
M T W T F S S
« Feb    
 123456
78910111213
14151617181920
21222324252627
28293031  
Web Analytics
Author: Emrah Gunduz