Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 4th Aug 2012, 07:45 PM   #1
WordPress Developer
War Room Member
 
Jeremy Lebre's Avatar
 
Join Date: 2012
Posts: 27
Thanks: 3
Thanked 4 Times in 3 Posts
Default
Allow HTML in WordPress comments
Share on: 
fb share twitter share gplus share more share

In WordPress, some HTML tags are forbidden by default in comments.
To allow them, add the following code to the functions.php file of your
theme:

PHP Code:
function comments_allowed_tags($data) {
global 
$allowedtags;
$allowedtags['a'] = array('class' => array(), 'href' => array(), 'name' => array(), 'rel' => array(), 'rev' => array(), 'style' => array(), 'title' => array());
$allowedtags['blockquote'] = array('cite' => array(), 'class' => array(), 'style' => array());
$allowedtags['code'] = array('class' => array(), 'style' => array());
$allowedtags['del'] = array('cite' => array(), 'class' => array(), 'datetime' => array(), 'style' => array());
$allowedtags['em'] = array('class' => array(), 'style' => array());
$allowedtags['ins'] = array('cite' => array(), 'class' => array(), 'datetime' => array(), 'style' => array());
$allowedtags['li'] = array('class' => array(), 'style' => array());
$allowedtags['ol'] = array('class' => array(), 'style' => array());
$allowedtags['p'] = array('class' => array(), 'style' => array());
$allowedtags['pre'] = array('class' => array(), 'style' => array());
$allowedtags['span'] = array('class' => array(), 'style' => array());
$allowedtags['strong'] = array('class' => array(), 'style' => array());
$allowedtags['ul'] = array('class' => array(), 'style' => array()); 
return 
$data; }

add_filter('preprocess_comment', 'comments_allowed_tags'); 

Jeremy Lebre is offline  
The Following 2 Users Say Thank You to Jeremy Lebre For This Useful Post:
Closed Thread


Bookmarks

Tags
comments, html, wordpress


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 05:26 PM.