Allow HTML in WordPress comments

0 replies
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'); 
#comments #html #wordpress

Trending Topics