• How do I disable HTML on comments? I don’t like it.
    Me and my visitors wants to do <3 hearts. But I can’t do that with html allowed.

    I know that it isn’t possible in WordPress settings but there must be some way to shut it off in the code?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Define “shut off”. Do you want html to be stripped out entirely? Because that won’t exactly work with <3 things, it would strip everything after the < mark.

    If you want html to be displayed as actual code, like if somebody types <b> then that actually shows up, you could add this to your theme’s functions.php file:

    add_filter('pre_comment_content','wp_specialchars');

    That will convert all <‘s into &lt;’s and so forth, making it not html anymore.

    Thread Starter viqtory

    (@viqtory)

    Oh that is exactly what I mean! Thank you very much.

    Me and my visitors wants to do <3 hearts

    That tells me you want the “smiley” thing. Search.

    Thread Starter viqtory

    (@viqtory)

    Noo i dont wanna do smileys! I want to do as it shows! Like when you type <b> is shall be like that. I dont want them to do any html at all, just plain text.

    And I do not have an functions.php in my theme, what do i do then?

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    And I do not have an functions.php in my theme, what do i do then?

    Create one. Make a text file. Put this in it:

    <?php
    add_filter('pre_comment_content','wp_specialchars');
    ?>

    Make sure that it has NO blank lines or spaces at the top (before the <?php) or at the bottom (after the ?>). Everything in the file must be inside the ? lines.

    Then rename the file to functions.php and upload it to your theme directory.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Shut off HTML on comments’ is closed to new replies.