Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#42748 closed defect (bug) (duplicate)

wpautop adds an extra <p>

Reported by: bobbingwide's profile bobbingwide Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Formatting Keywords:
Focuses: Cc:


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


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 (1)

#1 @pento
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #27350.

Note: See TracTickets for help on using tickets.