Make WordPress Core

Opened 16 years ago

Closed 12 years ago

#11986 closed defect (bug) (worksforme)

HTML comments in post/page content get wrapped in P tags

Reported by: npsites's profile NPSites Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9.1
Component: Editor Keywords: gsoc
Focuses: Cc:

Description

I don't know if someone already caught this i had mentioned it to someone in the #chat but

When you write a post or a page and include comment html tags

the comments end up being wrapped in <p> tags

<p><!-- comment --></p>

An older plugin i use makes use of comment tags to know where to insert content but comments may be used for other reasons inside posts.

the more comments you add
the more line breaks errr paragraph breaks

additionally the plugin I was using could not pickup the comment tag and insert the content.

Change History (3)

#1 @sivel
16 years ago

  • Keywords chicken go moo removed
  • Milestone changed from Unassigned to Future Release
  • Summary changed from <!-- comments --> wrapped in P Tags causes Line Breaks in Posts & Pages to HTML comments in post/page content get wrapped in P tags

#2 @wojtek.szkutnik
16 years ago

  • Keywords gsoc added

#3 @azaozz
12 years ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

HTML comments can only be added in the Text editor or by plugins in the Visual editor. They are treated as text by wpautop.

If the comment is on its own, it is wrapped in a <p> tag. This is actually useful for the <!--more--> tag, so the content is split without leaving behind broken tags. If the comment is "inline" with other text, it is treated as part of that text. So the plugin or the user in the Text editor can decide what happens to the comment in wpautop.

Note: See TracTickets for help on using tickets.