The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

WordPress encoding html comment tags (3 posts)

  1. Steve
    Posted 6 years ago #

    I've got some code which adds content to the post and I want to include some HTML comments in there.

    But I have a problem.

    The opening tag <!-- goes through fine but the closing tag --> gets turned into–> (thats & # 8211 > ) which of course breaks everything.

    I assume its actually some sort of bug in WordPress because <-- doesn't get converted so its not the presence of -- that makes it go wrong.

  2. esmi
    Forum Moderator
    Posted 6 years ago #

    Sounds more like your comment syntax is incorrect. It should be <-- and -->. The trailing and leading spaces are important.

  3. Steve
    Posted 6 years ago #

    I've tried just about every spacing option I can think of and it still does it. I guess I'll have to dig into the WordPress code and try to find out where it handles HTML comment tags and determine what it thinks a closing HTML comment looks like.

    Edited to add : Or it could have been down to a rogue > which got into the text.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.