WordPress.org

Make WordPress Core

Opened 12 months ago

#45144 new defect (bug)

Empty p-tags before image with caption in classic text editor

Reported by: codegrau Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.8
Component: Editor Keywords:
Focuses: Cc:
PR Number:

Description

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.

Change History (0)

Note: See TracTickets for help on using tickets.