Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#52833 closed defect (bug) (duplicate)

Invalid html output from wpautop

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

Description

Hi,
i've noticed extra </p> tags all over the place on my site and traced the problem to the wpautop function.
After bit of experimenting i can now reproduce this problem simply by running wpautop function on this HTML snippet:

<div>
<div>
    </div>
    </div>

The result is:

<div>
<div>
    </div>
</p></div>


Change History (1)

#1 @SergeyBiryukov
2 years ago

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

Hi there, welcome to WordPress Trac! Thanks for the report.

This appears to be the same issue as in #18136 and #43387, which has the same root cause as in #27350, so I would suggest following that latter ticket to continue the discussion.

Just to clarify, these extra </p> tags are not new in 5.7, but they are visible now in some scenarios where they were previously hidden. This is being tracked in #52764 for WordPress 5.7.1, see comment:8:ticket:52764 and later comments for some more context.

As a workaround, this snippet can be added to Appearance → Customize → Additional CSS:

body p:empty:before {
	content: none;
}
Last edited 2 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.