[wp-trac] [WordPress Trac] #52764: Classic editor adding empty <p></p> tags in some media embed situations

WordPress Trac noreply at wordpress.org
Wed Mar 10 17:25:03 UTC 2021


#52764: Classic editor adding empty <p></p> tags in some media embed situations
-----------------------------+-----------------------------
 Reporter:  jonathanstegall  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Editor           |    Version:  5.7
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 In 5.7, I'm noticing cases where empty `<p></p>` markup is being inserted
 around image embeds when posts are created with the Classic Editor. I
 tried reverting to 5.6.2 and they were no longer inserted.

 I'm having a little trouble isolating exactly when this happens, but
 here's what I'm noticing:

 1. The image has a caption
 2. The image is aligned left or right
 3. The image markup is followed immediately (without hitting enter) by
 paragraph text.

 This appears to happen whether I use the WYSIWYG or the Text Editor, but
 it does not happen with the Block Editor.

 I first noticed this on an established website, but have also been able to
 reproduce it on a clean WordPress install.

 Here's a paste where this does happen (I'm pasting what is in the Text
 Editor view):

 {{{
 Duis in lacus nibh. In vulputate ex urna, ac iaculis justo aliquam nec.
 Cras feugiat, risus sit amet lobortis scelerisque, nisi lorem ultrices
 magna, ut congue mauris neque sed sapien. Integer a arcu eu massa feugiat
 auctor. Quisque egestas mattis elit at condimentum. In ac tortor ac odio
 tempus sodales sit amet eu orci. Aenean quis velit orci. Donec id tortor
 eget metus consectetur fringilla. Nullam eu eros sit amet turpis egestas
 porttitor. In ullamcorper mauris nec orci commodo, sit amet mollis odio
 porta. Aenean pulvinar consectetur eros, in malesuada ex iaculis id.
 Quisque nec pharetra lorem.

 [caption id="attachment_604" align="alignright" width="300"]<img class
 ="size-medium wp-image-604" src="https://vanilla-wordpress.test/wp-
 content/uploads/2020/08/20714776-fe88-3f54-b657-a0228a93adbd-300x240.png"
 alt="this is my alt text" width="300" height="240" /> this is my
 caption[/caption]Phasellus tortor dui, hendrerit nec mollis ac, posuere
 non erat. Aliquam erat volutpat. Curabitur at urna augue. Nulla et urna
 aliquet, pulvinar ipsum eget, faucibus lorem. Aliquam erat volutpat.
 Aliquam nulla tortor, gravida in sodales aliquam, convallis fermentum
 mauris. Donec in nunc tortor. Donec posuere viverra condimentum. Donec
 placerat vel lacus sed sagittis. In orci dui, tristique ut lobortis at,
 gravida in sapien.
 }}}

 And here's the markup it generates (I'm using the Twenty Twenty One theme
 in this case):

 {{{
 <p>Duis in lacus nibh. In vulputate ex urna, ac iaculis justo aliquam nec.
 Cras feugiat, risus sit amet lobortis scelerisque, nisi lorem ultrices
 magna, ut congue mauris neque sed sapien. Integer a arcu eu massa feugiat
 auctor. Quisque egestas mattis elit at condimentum. In ac tortor ac odio
 tempus sodales sit amet eu orci. Aenean quis velit orci. Donec id tortor
 eget metus consectetur fringilla. Nullam eu eros sit amet turpis egestas
 porttitor. In ullamcorper mauris nec orci commodo, sit amet mollis odio
 porta. Aenean pulvinar consectetur eros, in malesuada ex iaculis id.
 Quisque nec pharetra lorem.</p>
 <p></p><figure id="attachment_604" aria-describedby="caption-
 attachment-604" style="width: 300px" class="wp-caption alignright"><img
 loading="lazy" class="size-medium wp-image-604" src="https://vanilla-
 wordpress.test/wp-content/uploads/2020/08/20714776-fe88-3f54-b657
 -a0228a93adbd-300x240.png" alt="this is my alt text" srcset="https
 ://vanilla-wordpress.test/wp-
 content/uploads/2020/08/20714776-fe88-3f54-b657-a0228a93adbd-300x240.png
 300w, https://vanilla-wordpress.test/wp-
 content/uploads/2020/08/20714776-fe88-3f54-b657-a0228a93adbd.png 448w"
 sizes="(max-width: 300px) 100vw, 300px" width="300"
 height="240"><figcaption id="caption-attachment-604" class="wp-caption-
 text">this is my caption</figcaption></figure>Phasellus tortor dui,
 hendrerit nec mollis ac, posuere non erat. Aliquam erat volutpat.
 Curabitur at urna augue. Nulla et urna aliquet, pulvinar ipsum eget,
 faucibus lorem. Aliquam erat volutpat. Aliquam nulla tortor, gravida in
 sodales aliquam, convallis fermentum mauris. Donec in nunc tortor. Donec
 posuere viverra condimentum. Donec placerat vel lacus sed sagittis. In
 orci dui, tristique ut lobortis at, gravida in sapien.<p></p>
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52764>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list