Make WordPress Core

Opened 8 years ago

Last modified 4 years ago

#34383 new feature request

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:


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 (1)

#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.

Note: See TracTickets for help on using tickets.