WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 19 months ago

#28762 new defect (bug)

Self-closing HTML tags create orphaned closing </p> tag in wpautop

Reported by: maimairel Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.9.1
Component: Formatting Keywords: has-unit-tests wpautop
Focuses: Cc:

Description

When using self closing tags like <hr> followed by a line of text separated by newline, wpautop returns invalid HTML.

Consider the following example:

<hr> test

When inserting this into WordPress editor in text mode, the_content will return the following invalid HTML:

<hr> test</p>

Attachments (2)

Autop.php.patch (1.1 KB) - added by pbearne 4 years ago.
added unit to check if handle self closing tag
Autop.php.2.patch (14.1 KB) - added by pbearne 4 years ago.
patch with some more tests :-)

Download all attachments as: .zip

Change History (8)

@pbearne
4 years ago

added unit to check if handle self closing tag

#1 @pbearne
4 years ago

  • Keywords has-unit-test added

added quick unit to confirm

@pbearne
4 years ago

patch with some more tests :-)

#2 @tomauger
4 years ago

Thanks @maimariel for your bug report. The tests confirm what you are reporting and this should be addressed soon!

#3 @SergeyBiryukov
4 years ago

  • Component changed from General to Formatting
  • Focuses template removed
  • Keywords has-unit-tests added; has-unit-test removed

Related: #18136, #20444, #21689.

#4 @miqrogroove
4 years ago

  • Keywords wpautop added

#5 @ericlewis
4 years ago

  • Summary changed from wpautop and HTML self closing tags to Self-closing HTML tags create orphaned closing </p> tag in wpautop
Note: See TracTickets for help on using tickets.