WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 6 months ago

#37238 new defect (bug)

Right-aligned captions with embedded iframes get removed in Visual mode

Reported by: ChrisBAshton Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.3
Component: Shortcodes Keywords:
Focuses: Cc:
PR Number:

Description

This has affected a client site a couple of times now so I thought I'd better share it and see if this is a bug or if there is something we are doing fundamentally wrong.

If you are working in Text mode and you end up creating a caption, right-aligning it and embedding an iframe within the caption shortcode, as follows...

[caption width="350" class="alignright" caption="Ria Ritchie's latest video on YouTube"]<iframe width="350" height="197" class="alignright" src="https://www.youtube.com/embed/_W9f5onA6nc?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>[/caption]

...if anyone comes along in Visual mode they can see the embedded iframe right-aligned and with the caption below it. If they make a change to any part of the post and hit 'Update', the caption and iframe get removed, but the caption text remains (without any surrounding markup).

Change History (1)

#1 @desrosj
6 months ago

  • Component changed from Posts, Post Types to Shortcodes
  • Milestone Awaiting Review deleted

Hi @ChrisBAshton,

Welcome to Trac! And thanks for this ticket. My apologies that it took so long to receive a response.

The [caption] shortcode is actually only meant to be used with <a> and <img /> tags. I think this is working as expected.

I am going to close this out, but if you feel <iframe>s should be allowed within captions, feel free to reopen with some more details.

Note: See TracTickets for help on using tickets.