WordPress allows few HTML tags within the content of post comments. This is a good feature because it prevents security holes and other malicious code from being injected by spammers or hackers. There are many other tags that bloggers may want to support, design and development bloggers may want to support PRE tags so commenters can post code.
Add the following code in your functions.php file.
[php]
/** Function Allows More Tags Within Comments */
function allow_pres() {
global $allowedtags;
$allowedtags[‘pre’] = array(‘class’=>array());
}
/** WordPress Hook To Use The Function */
add_action(‘comment_post’, ‘allow_pres’);
[/php]
The global $allowedtags variable holds an array of allowed comment tags, so adding the ‘pre’ key will allow PRE elements within comments.
You may also be interested in our other articles on disable auto generated paragraph tags, nofollow wordpress tag cloud, improve wordpress jpeg image quality and force auto update of wordpress.
Leave a Reply