Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#8888 closed enhancement (duplicate)

Inserting image without caption permanently erases attachment post_excerpt; can't insert image with alt text and no caption

Reported by: sam_a's profile Sam_a Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords: 2nd-opinion needs-patch media-upload
Focuses: Cc:


In the "Add an image: Media Library" dialog, an image attachment with a non-empty Caption field is always inserted with a printed caption. If you clear the Caption field and click Insert into post, the image is inserted with no printed caption (and no alternative text either) -- but that permanently erases the attachment's excerpt.

So I think we need 2 changes:

  • Authors should be able to choose whether to insert a printed caption without making permanent changes to the attachment's caption field (maybe via a checkbox that says, e.g., ☑ Print a caption beneath the image); and
  • Images inserted without a printed caption should have alternative text from the Caption field

Change History (7)

#1 @azaozz
15 years ago

  • Component changed from General to UI
  • Milestone changed from 2.7.1 to 2.8
  • Resolution set to wontfix
  • Status changed from new to closed
  • Type changed from defect (bug) to enhancement

When an image is reused (added in another post) it will be inserted with the same settings like the first time it was used. This seems to be the expected behaviour.

If any of the settings need to be changed, like caption, alt text, link, alignment, etc. the image can be edited from the Edit Image popup on per post basis.

Having a checkbox to not insert a caption despite that a caption has been entered in the field seems contra-intuitive.

#2 @Sam_a
15 years ago

  • Component changed from UI to General
  • Keywords 2nd-opinion added
  • Resolution wontfix deleted
  • Status changed from closed to reopened
  • Summary changed from Can't insert image without caption (unless you erase attachment's post_excerpt field) to Inserting image without caption permanently erases attachment post_excerpt; can't insert image with alt text and no caption
  • Type changed from enhancement to defect (bug)

I agree with all of the "expected behavior" of the Insert Image dialog mentioned above, but there are 2 defects here:

  • When inserting an image alone (without printed caption), alternative text should come from the dialog field labeled Also used as alternate text for the image. That doesn't happen.
  • Authors should be able to insert an un-captioned image at any one time without permanently erasing attachment data. (Remember an attachment's post_excerpt field is used in places besides the Insert Media dialog.)

An example will help:

I have a bunch of images in my Media Library. When I upload them, I fill in the caption field. Mostly I show them in my templates. Sometimes I want to insert them into posts/Pages using the convenient Insert Image dialog.

I want to insert an image by itself (no printed caption), so I have to clear what I wrote earlier from the dialog's caption field and click "Insert". That empties alternative text in the inserted image (not what I wanted) and erases the caption and alt text on the published attachment page and anywhere else I use the attachment_link and attachment_image template tags. And if I later want to insert that image with a printed caption, I would have to write and save the caption text all over again. Then erase it if I want to omit the caption. Then repeat.

I'm not committed to any particular UI solution in the Insert Image dialog, but it should be fixed somehow.

#3 @ryan
15 years ago

  • Component changed from General to Media

#4 @Denis-de-Bernardy
15 years ago

  • Milestone changed from 2.8 to Future Release
  • Type changed from defect (bug) to feature request

I'm itching to close as wontfix too.

You would then need to insert the image twice or more. if you change the caption on the image, it is expected that its caption gets changed everywhere.

Alternatively (the reason I'm not closing this), WP could duplicate the attachment when the post_parent changes.

Either way, patch is missing and it's clearly an edge case, so future.

#5 @Denis-de-Bernardy
15 years ago

  • Type changed from feature request to enhancement

#6 @Denis-de-Bernardy
15 years ago

  • Resolution set to duplicate
  • Status changed from reopened to closed

See #6862.

#7 @Denis-de-Bernardy
15 years ago

  • Milestone Future Release deleted

err, sorry: #6820 even. :-)

Note: See TracTickets for help on using tickets.