[wp-trac] [WordPress Trac] #45144: Empty p-tags before image with caption in classic text editor

WordPress Trac noreply at wordpress.org
Mon Oct 22 12:55:34 UTC 2018


#45144: Empty p-tags before image with caption in classic text editor
--------------------------+-----------------------------
 Reporter:  codegrau      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  4.9.8
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Adding an image with caption in "classic" text editor (my preferred
 editor) will result in empty p-tags before figure tags and non-surrounded
 text after <figure>.

 Press the Media Button in WordPress classic text editor to insert an image
 with caption. Following output is generated:
 {{{
 [caption id="attachment_1" align="alignleft" width="150"]<img src="url-to-
 image.jpg" alt="alt" width="150" height="150" class="size-thumbnail wp-
 image-1" /> captiontext[/caption] This is text for my Test post with
 Image.
 }}}

 When using the classic text editor, the output begins with an empty
 paragraph tag like:

 {{{
 <p></p> <!-- empty p-tag before figure-tag -->
 <figure>
 <img src="...">
 <figcaption>...</figcaption>
 </figure>
 " This is text for my Test post with Image." <!-- no tags at all -->
 }}}

 when saving afterwards in "visual editor" (or editing and saving the whole
 post) the output is correct:

 {{{
 <figure>
 <img src="...">
 <figcaption>...</figcaption>
 </figure>
 <p>This is text for my Test post with Image.</p>
 }}}

 Please have a look at this.

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


More information about the wp-trac mailing list