WordPress.org

Make WordPress Core

Opened 6 months ago

#42748 new defect (bug)

wpautop adds an extra <p>

Reported by: bobbingwide Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Formatting Keywords:
Focuses: Cc:

Description

With the following input

$input      = "<div>\n<div></div>\n" .         "<span></span></div>\n";

wpautop produces the unexpected output

$unexpected = "<div>\n<div></div>\n" . "<p>" . "<span></span></div>\n";

This is very similar to #39377. Note: I added the newlines to the input to make the difference more obvious.

  • div before span gives p
  • span before div gives /p

Workaround

For my affected plugin I've written a PHPUnit test case that will fail when wpautop's behaviour no longer produces the unexpected results. And I'm changing my code to avoid mixing spans and divs.

Change History (0)

Note: See TracTickets for help on using tickets.