Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#52833 closed defect (bug) (duplicate)

Invalid html output from wpautop

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

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
6 years ago

  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → 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 6 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.