WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 11 months ago

#36418 new defect (bug)

Custom MIME type icons lost in WP Media List view

Reported by: jhorowitz Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords: dev-feedback
Focuses: administration Cc:

Description

The ability to define custom MIME icons has been possible since at least v2.5, by hooking into several filters, one of which is icons_dir.

icons_dir allows you to specify additional directory/uri pairs for the wp_mime_type_icon routine to search, ideally adding icon support for additional MIME types.

However, going through SVN history, it seems that almost from the beginning of the availability of that hook, there has been a loophole where the additional icon directories are ignored!

Specifically:

wp_get_attachment_image_src calls wp_mime_type_icon, which in theory could select a custom icon directory added by the icon_dirs hook. It then attempts to fetch width and height information from the selected icon file, but only checks the default wp-includes/images/media directory. Of course, this prevents the custom icons from displaying when fetched through wp_get_attachment_image_src.

Attachments (1)

media.php.patch (1021 bytes) - added by jhorowitz 2 years ago.
Patch to make wp_get_attachment_image_src check the same icon file directories as wp_mime_type_icon

Download all attachments as: .zip

Change History (4)

@jhorowitz
2 years ago

Patch to make wp_get_attachment_image_src check the same icon file directories as wp_mime_type_icon

#1 @jhorowitz
2 years ago

  • Focuses administration added
  • Keywords dev-feedback added

#2 @chriscct7
2 years ago

  • Version trunk deleted

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


11 months ago

Note: See TracTickets for help on using tickets.