Make WordPress Core

Opened 8 years ago

Closed 6 weeks ago

#34383 closed feature request (wontfix)

Feature Request - Add ID field and function to dynamically generate image IDs for images in the Media Library

Reported by: mudboxmedia's profile mudboxmedia Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3.1
Component: Media Keywords:
Focuses: ui, administration Cc:

Description

I have a feature request for WordPress core. I'd like to see an HTML ID field in addition to the fields for URL, Title, Caption, Alt Text, and Description in the Media Library. Having this field for input and a function to dynamically output the id attribute as part of core would allow developers to rapidly style specific images without having to re-code themes.

Change History (2)

#1 @swissspidy
8 years ago

Hi there! Welcome to trac and thanks for your report.

When you insert an image from the media library into a post, it already has a class like wp-image-755, where 755 is the attachment ID.

I wouldn't encourage you to use HTML ID attributes. You cannot guarantee that the image will exist only once on a page. That's why you should target classes whenever possible.

#2 @joedolson
6 weeks ago

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

Given @swissspidy's comments, which I agree with, and the 8 years that have passed since this request, I'm closing this as wontfix. I'll also note that the potential for a re-use of an ID attribute can cause accessibility issues, so it's definitely something to avoid.

Note: See TracTickets for help on using tickets.