WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#7675 closed enhancement (fixed)

If no caption entered, use attachment title for alt text

Reported by: Viper007Bond Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.7
Component: General Keywords: has-patch
Focuses: Cc:

Description

Currently if you leave the caption field blank, the alt text gets left blank too when you insert a single attachment into your post.

<img src="..." alt="" title="Attachment Title" />

Attachments (1)

7675.patch (592 bytes) - added by Viper007Bond 6 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 tabreziqbal6 years ago

To add my comments: If you want to enter only Alt text for the uploaded images, you don't have good options:

  1. Either enter a Caption and it will be copied to Alt
  2. or enter a Title and copy it to Alt manually in the generated code.

Give user the option to copy either Caption text or Title text to the Alt attribute. Or allow Alt text to be entered in a separate text field.

comment:2 Viper007Bond6 years ago

  • Keywords has-patch removed

No patch from me afterall. No matter what I edit I can't seem to change the text that gets sent to the editor.

comment:3 ShaneF6 years ago

  • Owner changed from anonymous to ShaneF
  • Status changed from new to assigned

Are we talking images form the media library and gallery to the editor?

I figure it out last night since I wanted the "title" in the <a> part of the URL when linking to an image because of lightbox. I'll send you a patch file when I get back today.

comment:4 Viper007Bond6 years ago

Yes, the add media button and then "Insert Into Post".

Viper007Bond6 years ago

comment:5 Viper007Bond6 years ago

Got it working thanks to ShaneF. A new variable is needed otherwise it'll be wrapped in [caption].

comment:6 ShaneF6 years ago

No prob. wp team: be aware that this might conflict with 7607?

comment:7 follow-up: ShaneF6 years ago

No prob. wp team: be aware that this might conflict with my patch over with #7607

comment:8 in reply to: ↑ 7 Viper007Bond6 years ago

Replying to ShaneF:

No prob. wp team: be aware that this might conflict with my patch over with #7607

I don't see why it would. It just changes the text passed to get_image_tag() to make sure the alt is never blank. It's also above your patch in the code.

comment:9 Viper007Bond6 years ago

  • Keywords has-patch added

comment:10 Viper007Bond6 years ago

  • Owner ShaneF deleted
  • Status changed from assigned to new

comment:11 azaozz6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [9210]) If no caption entered, use attachment title for alt text, props Viper007Bond, fixes #7675

Note: See TracTickets for help on using tickets.