WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#21541 closed defect (bug) (invalid)

Image caption in the visual editor not integrating proper html code

Reported by: Gouri Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords: needs-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

The image caption that I add in the visual editor is not getting integrated properly in the html editor.

When I make corrections in the html editor and update it, it works fine.

But again when I go to the visual editor and save the post, all the corrections I made in html editor goes for a toss.

For example,
This is how the code is supposed to be:

[caption id="attachment_1263" align="aligncenter" width="600" caption="photo credit: www.flickr.com/photos/tonystanley/399738240/"]<img class="wp-image-1263    " title="munnar" src="http://www.traveldest.org/wp-content/uploads/munnar.jpg" alt="munnar" width="600" height="398" />[/caption]

But this is what is inserted by visual editor:

[caption id="attachment_1263" align="aligncenter" width="600"]<img class="wp-image-1263    " title="munnar" src="http://www.traveldest.org/wp-content/uploads/munnar.jpg" alt="munnar" width="600" height="398" /> photo credit: www.flickr.com/photos/tonystanley/399738240/[/caption]

Attachments (1)

image-caption-bug.jpg (285.6 KB) - added by Gouri 3 years ago.

Download all attachments as: .zip

Change History (3)

@Gouri3 years ago

comment:1 @SergeyBiryukov3 years ago

  • Description modified (diff)

comment:2 @azaozz3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 3.4.1 deleted

You have listed the old and the new format for the image caption shortcode, and yes, there is code in the wpeditimage plugin for TinyMCE to convert that shortcode from the old to the new format.

If the 'img_caption_shortcode' filter is used (as it should) there will be no differences as the format is normalized before applying the filter.

For more info see #18311.

Note: See TracTickets for help on using tickets.