How can I remove some of the allowed HTML tags in comments/posts? For whatever reason, the following code, placed in my theme's functions.php
, didn't work:
add_action('init', 'my_html_tags_code', 10);
function my_html_tags_code() {
define('CUSTOM_TAGS', true);
global $allowedposttags, $allowedtags;
$allowedposttags = array(
'strong' => array(),
'em' => array(),
'pre' => array(),
'code' => array(),
'a' => array(
'href' => array (),
'title' => array ())
);
$allowedtags = array(
'strong' => array(),
'em' => array(),
'a' => array(
'href' => array (),
'title' => array ())
);
}
Tags such as <div>
or <pre>
are still available when commenting.
<pre>
isn't allowed by default. I think this setting is getting changed elsewhere. Maybe by a plugin. – sakibmoon Aug 17 '14 at 9:12