WordPress.org

Make WordPress Core

Opened 21 months ago

Last modified 7 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: close reporter-feedback
Focuses: Cc:

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 (2)

This ticket was mentioned in Slack in #core by talldanwp. View the logs.


7 months ago

#2 @talldanwp
7 months ago

  • Keywords close reporter-feedback added

Hi @codegrau, thanks for reporting this, and apologies for the delayed response!

This ticket was mentioned in a triage session in slack (requires a slack account to access - https://wordpress.slack.com/archives/core/p1576734592046500)

A few of us tested this using the Classic Editor plugin with a more recent version of WordPress, and weren't able to reproduce the problem you mentioned. Is this something you're still experiencing?

Note: See TracTickets for help on using tickets.