• According to the codex and this link the most unobtrusive way is to add a custom function to the functions.php file like this:

    add_filter('preprocess_comment','fa_allow_tags_in_comments');
    function fa_allow_tags_in_comments($data) {
    	global $allowedtags;
    	$allowedtags['span'] = array('style'=>array());
    	$allowedtags['p'] = array();
    	return $data;
    }

    so I added the example code to my functions.php file and edited in the tags I need

    add_filter('preprocess_comment','fa_allow_tags_in_comments');
    function fa_allow_tags_in_comments($data) {
    	global $allowedtags;
    	$allowedtags['span'] = array('style'=>array());
    	$allowedtags['p'] = array();
            $allowedtags['ul'] = array();
            $allowedtags['li'] = array();
    	return $data;
    }

    Now a simple question, is there anything redundant I can remove from this code. For example is it necessary to have these two lines?

    $allowedtags['span'] = array('style'=>array());
    	$allowedtags['p'] = array();

    or were they simply included by the codex and blog authors for illustrative purposes. i.e. I can delete those two lines?

  • The topic ‘How to add unordered list and list item HTML tags in comments’ is closed to new replies.