[wp-trac] [WordPress Trac] #48256: WP remove first <p> in <td>
WordPress Trac
noreply at wordpress.org
Wed Dec 18 10:26:15 UTC 2019
#48256: WP remove first <p> in <td>
--------------------------+------------------------------
Reporter: Sebafaim | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 5.2.3
Severity: major | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+------------------------------
Changes (by alpipego):
* keywords: => needs-patch
* severity: minor => major
Comment:
In `wpautop` a block element immediately followed by an inline(-block)
element causes this issue. For me it was `<div><img …>…</div>` getting
turned into `<div><img …></p>…</div>`.
The issue is that markup like this:
{{{
<div>
<img src="https://source.unsplash.com/random/800x600" alt=""
width="800" height="600" />
<p>Here is some paragraph</p>
</div>
}}}
gets split into
{{{
<div><img src="https://source.unsplash.com/random/800x600" alt=""
width="800" height="600" />
}}}
{{{
<p>Here is some paragraph</p>
}}}
{{{
<div>
}}}
concatenated to
{{{
<p><div><img src="https://source.unsplash.com/random/800x600" alt=""
width="800" height="600" /></p>
<p><p>Here is some paragraph</p></p>
<p></div></p>
}}}
The opening `<p>` then gets removed for the first fragment above in
https://core.trac.wordpress.org/browser/trunk/src/wp-
includes/formatting.php#L578 but the closing one stays.
I've changed the severity to major, since this leads to invalid HTML
markup in the output.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48256#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list