Skip to content

Instantly share code, notes, and snippets.

@stephenharris
Created August 12, 2013 15:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephenharris/6211644 to your computer and use it in GitHub Desktop.
Save stephenharris/6211644 to your computer and use it in GitHub Desktop.
Allow pre tags in comments
<?php
/**
* Allow 'pre' tags in comments.
* This is not by default allowed for users who cannot publish 'unfiltered_html'.
* Maybe this should go in WP-MarkDown?
*
*/
add_filter( 'wp_kses_allowed_html', 'myprefix_allow_pre_tags_in_comments', 10, 2 );
function myprefix_allow_pre_tags_in_comments( $tags, $context ){
if( 'pre_comment_content' == $context ){
$tags['pre'] = array();
}
return $tags;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment