WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have no problem doing this in a comment, as an administrator:

<b>bold test</b> <i>italics test</i>
<u>underline test</u> <font
color="#ff9900"> color test</font>

But the subscribers can't underline, add color to words nor add images.

Is it that only the admin can use more HTML tags than those suggested under the comment form?

<a href="" title=""> <abbr title="">
<acronym title=""> <b> <blockquote
cite=""> <cite> <code> <del
datetime=""> <em> <i> <q cite="">
<strike> <strong>

How to enable the subscribers to add color to text, and add images?

share|improve this question
How about using roles to acchieve this? codex.wordpress.org/Function_Reference/comment_class – kaiser May 23 '11 at 22:19
up vote 2 down vote accepted

The tags that are allowed in comments are stored in the $allowedtags global variable. You can try adding elements to that list (the key is the tag name, the value is an array of allowed attributes). If you have problems with the timing you can play with the CUSTOM_TAGS global variable.

share|improve this answer

I too needed to customise the list of available HTML tags in comments. I didn't want to define the CUSTOM_TAGS variable because it overrides everything that WP sets up in kses.php, but I wasn't sure where to hook the function. A little investigation showed that kses.php initialises its filters via kses_init() which is added as a function to 'init' with the default priority of 10, so...

 * customise list of allowed HTML tags in comments
function gregory_customise_allowedTags() {

    global $allowedtags;

    // remove unwanted tags
    $unwanted = array(
    foreach ( $unwanted as $tag )
        unset( $allowedtags[$tag] );

    // add wanted tags
    $newTags = array(
        'span' => array(
            'lang' => array()),
        'u' => array()
    $allowedtags = array_merge( $allowedtags, $newTags );


add_action('init', 'gregory_customise_allowedTags', 11 );


share|improve this answer

Just more exmple :

function allow_tags_content() {
    global $allowedposttags, $allowedtags;

    $allowedposttags['div']['data-hello'] = true;
    $allowedtags['div']['data-hello'] = true;

    $allowedposttags['div']['data-world'] = true;
    $allowedtags['div']['data-world'] = true;
share|improve this answer

protected by Community Apr 10 '12 at 11:21

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.