Articles of allowedtags

Change allowed HTML tags for comments

I’ve set up a HTML editor for WordPress comments, and I want to change the allowed HTML tags for comments accordingly. Some of the HTML tags also have inline styling, or classes added. I only want to allow the styling and classes that I’m expecting, but I cannot get it to work. I want to […]

Make WordPress process admin group comments using $allowedtags

WP uses $allowedtags to limit the set of allowable tags for comments.However, comments from administrators are unfiltered. What’s the easiest way to ensure admin comments are also constrained to the tags contained in $allowedtags?

preg_replace and comment_form_defaults

this was kinda of a joke at the beginning but now I’m wondering if it’s possible to use regex with the hook comment_form_defaults. Here is what I’m looking for : function remove_default_allowed_tags( $defaults) { $defaults = preg_replace(‘/<p class=”form-allowed-tags”>(.*?)<\/p>/’,”, $defaults); return $defaults; } add_filter(‘comment_form_defaults’, ‘remove_default_allowed_tags’, 2); I know it can be easily done with something like […]

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’ […]

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’ […]

Adding target and _blank as it's value to the allowedtags

I know that WordPress uses KSES to parse HTML and strip invalid XHTML so I took control of $allowedtags in my themes functions.php file inside a function then added ‘target’ keyed to an array which contains ‘_blank’ keyed to an empty array. I thought this would work but my link still seems to not contain […]