Opened 8 years ago
Last modified 6 years ago
#40299 new defect (bug)
Removing width attribute on an image with a caption removes entire caption
Reported by: | catchmyfame | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.7.3 |
Component: | Media | Keywords: | needs-patch |
Focuses: | Cc: |
Description (last modified by )
If you insert an image with a caption into the visual editor, it will create code like:
[caption id="attachment_12345" align="alignnone" width="150"]<img class="wp-image-12345 size-thumbnail" src="https://www.example.com/wp-content/uploads/2017/03/image.png" alt="" width="150" height="150" /> My caption[/caption]
If you switch from the visual editor to the text editor and remove the width
attribute of the image to get:
[caption id="attachment_12345" align="alignnone" width="150"]<img class="wp-image-12345 size-thumbnail" src="https://www.example.com/wp-content/uploads/2017/03/image.png" alt="" height="150" /> My caption[/caption]
And then either update the post, or switch back to the visual editor, the caption is stripped and only the image remains:
<img class="wp-image-12345 size-thumbnail" src="https://www.example.com/wp-content/uploads/2017/03/image.png" alt="" height="150" />
Removing the height
attribute doesn't appear to cause the same behavior. I don't believe that removing the width attribute on the image should result in both the caption being stripped and the [caption]
shortcode being removed.
I'm not sure but this might be related to [27426] and #23103.
Change History (3)
Note: See
TracTickets for help on using
tickets.
In the recent Media component meeting we reviewed this issue and confirmed that the issue exists with the classic-editor plugin enabled but not in the classic-block available in Gutenberg. This is still valid for Classic Editor so we should leave this as
future release
and this will need a patch. :)