What is the function to list allowed XHTML tags for comments (7 posts)

  1. mawilson
    Posted 9 years ago #

    Many WP blogs include a list of allowed XHTML tags on their comments form... I know that WP uses kses.php to process the comments (from http://wordpress.org/support/topic/76975); however I can't find details on which function to use to list out the allowed tags to my users.

    Please, can anyone offer me some advice?


  2. Alex Cragg
    Posted 9 years ago #

    in your comments.php look for something like this
    <p><strong>Some HTML allowed:</strong><br/><?php echo allowed_tags(); ?></p>

    it might be there and edited out, if so remove the editing comments.

    if it isnt there, put in the php call with whatever else you want, ive got the p and strong tags.

  3. mawilson
    Posted 9 years ago #

    Fantastic! That did the trick - thank you. Now, does anyone know how I remove <b> and <i> from the allowed list as they have been deprecated in XHTML 1.1?

  4. whooami
    Posted 9 years ago #

    edit wp-includes/kses.php

  5. Don't bother removing them. B and I get transformed into strong and em automatically anyway. I think. Try it and see. :)

  6. mawilson
    Posted 9 years ago #

    @whooami... thanks for that guidance - sorry if that is too obvious but I didn't know if there was a preferred method or anything. Commenting out the <b>, <i> and <strike> tags in $allowed tags worked as I'd hoped.

    @Otto42 - thanks also for taking the time to reply; however I have removed the non-compliant tags just in case ;-)

  7. cheberk
    Posted 8 years ago #

    I just set up a blog for students in my intro to web design class (more of a design class than a programming class). I want them to be able to use the style tag in their posts... Yes, it's going to make for some hideous comments, but that's part of the learning process.

    Can you be more specific about how to allow the style tag to the kses.php file?


Topic Closed

This topic has been closed to new replies.

About this Topic