WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] HTML entities in comments (5 posts)

  1. Adam Brown
    Member
    Posted 6 years ago #

    I made a plugin for my blog that replicates the backticks function available here on the forum. It's a simple little plugin. As you can guess it uses htmlspecialchars() (among other things) on the stuff in the backticks. But I found something weird.

    If a comment contains ' in it, it doesn't post. (Incidentally, I'm having trouble pasting it here, but you can probably tell what I mean--remove the "amp;" from the entity.) You hit submit, and WP just reloads the current post without posting the comment. (It's not in the moderation/spam queues, it's just gone.)

    Any ideas?

    EDIT: It took me a few tries to get the entity to paste. It's there now.

  2. Dalton
    Member
    Posted 6 years ago #

    Hey, would you be interested in sharing that plugin?

  3. Adam Brown
    Member
    Posted 6 years ago #

    Certainly. I've got some wrapping up to do with it, though. I'll post a note here when it's ready:

    http://adambrown.info/b/widgets/

    As for the problem I posted about, I've got a nasty workaround that uses both an early and a late filter to insert the correct entity. But if anybody knows why comments don't post with th #39; entity in them, that would be awesome...

    This is a WPMU 1.2.5a setup, but most of the code (almost certainly all parts relevant to my question) are from the WP 2.2+ series.

  4. Adam Brown
    Member
    Posted 6 years ago #

    As promised, you can now get it here:

    kb backtick comments

    The functionality should all be fine, although I haven't spent a great deal of time making the CSS perfect, so it might look a little funky depending on your browser.

    But I figure people will need to adjust the plugin's CSS on a theme-by-theme basis, so it doesn't make much sense for me to waste time on it.

  5. Dalton
    Member
    Posted 6 years ago #

    Fantastic, thank you. I'm going to give this a try right now.

Topic Closed

This topic has been closed to new replies.

About this Topic