Filtering the Comment Form Allowed Tags

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’ … Read more

Allow all attributes in $allowedposttags tags

I would like to use $allowedposttags to allow extra HTML tags during entry submission. Can I allow all attributes for a specific tag using $allowedposttags? For example, the code below will allow iframe tags and the src, height, and width attributes in the iframe tags: $allowedposttags[‘iframe’] = array( ‘src’ => array(), ‘height’ => array(), ‘width’ … Read more

How to allow data:image attribute in src tag during post insert?

I’m inserting a post using wp_post_insert(). And my post’s content looks like this: <img src=”data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAN4AAAB6CA { … } but on the insert process, WordPress removes the data attribute. So above code becomes this: <img src=”image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAN4AAAB6CA { … } I’ve tried something like this but no luck: function my_filter_allowed_html($allowed, $context){ if (is_array($context)) { return … Read more