/** * Allows HTML tags in WordPress comments. * * This example will add the `<pre>` tag (and its `class` attribute). * * @see https://wpcodebook.com/allow-html-tags-wordpress-comments/ * @see https://developer.wordpress.org/reference/functions/allowed_tags/ */ add_action( 'init', function () { global $allowedtags; $allowedtags['pre'] = array( 'class' => array() ); } );
allowed_tags()
function output before and after adding the <pre>
tag:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="">