Make WordPress Core

Opened 2 years ago

Last modified 4 days ago

#38195 new enhancement

Adding more mime_types filter to Media Library

Reported by: zodiac1978 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch dev-feedback has-screenshots ui-feedback
Focuses: Cc:


In https://github.com/WordPress/WordPress/blob/e0a0be9579bf00c673f6fa9c68e87d4546271b37/wp-includes/post.php#L2191-L2206 WordPress is defining some default mime_types for filtering purpose in the media library.

At the moment this is everything starting with image, audio and video.

But there are more mime_types possible:

What about adding these mime_types in the way shown in #30788 ?

I suggest the following groups:

application/vnd (should handle MS, LO/OOo and iWorks)
application/x-msdownload (exe)

I'm just concerned about a possible performance problem.
See: #31071

Attachments (3)

38195.diff (4.5 KB) - added by zodiac1978 2 years ago.
Proof of concept
new-UI.png (79.4 KB) - added by zodiac1978 2 years ago.
The new dropdown would look like this
38195.2.diff (5.2 KB) - added by swissspidy 13 months ago.

Download all attachments as: .zip

Change History (14)

#1 follow-up: @lukecavanagh
2 years ago


Maybe to Documents:

Also add

#2 in reply to: ↑ 1 @zodiac1978
2 years ago

Replying to lukecavanagh:

Maybe to Documents:

Also add

This has to be added to the allowed mime types in wp_get_mime_types:

I am talking about the filter dropdown in /wp-admin/upload.php.

2 years ago

Proof of concept

2 years ago

The new dropdown would look like this

#4 @zodiac1978
2 years ago

  • Keywords has-patch dev-feedback has-screenshots added

I think there is better way to achieve the same result. Maybe as an array and with implode? And some filters would be great to add more mime-types to the specific groups. But for now this is an proof of concept, how it can look if we want to implement this.

Powered by #WCMIL Contributor Day :)

Last edited 2 years ago by zodiac1978 (previous) (diff)

#5 @swissspidy
2 years ago

  • Milestone changed from Awaiting Review to Future Release

#6 @zodiac1978
13 months ago

@swissspidy Any chance to get more feedback on this topic than "Future Release"? ;)
A "Wontfix" is totally okay, just want to know if this is something worth considering ...

13 months ago

#7 @swissspidy
13 months ago

I just refreshed the patch in 38195.2.diff.

I like this enhancement, but it's probably best to bring this up in the weekly media chat in #core-media on Thursday to get a second opinion.

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

11 months ago

#9 follow-up: @karmatosed
11 months ago

  • Keywords ui-feedback added

I think right now I'd vote without thought to having 'Documents' added. I am less keen on all the other options, that's not saying some aren't really useful, I just would like to also work out the UI as we add more and more. Documents could be added now and that design problem doesn't need working out.

I would note that some terms used we totally should look at if we do add, for example terms like 'web documents' and 'interactives' could do with investigating if the right ones.

This brings up a design issue though as said, that many items in a drop down causes people to just skip over, not find what they are looking for. We should consider iterating the interface, over adding more than one extra here.

#10 in reply to: ↑ 9 @zodiac1978
3 months ago

Replying to karmatosed:

This brings up a design issue though as said, that many items in a drop down causes people to just skip over, not find what they are looking for.

It is worth mentioning that these new entries just show up if you upload files with these mime types.

I am happily discuss better wordings, but at the moment these are the only suggestions, why not starting with it? Or if you or someone else have specific problems with some of them, please write about it and suggest better ones. I was just trying to find words to describe groups of mime types because of the mentioned UI issue. I don't want to flood this drop down with too many new entries.

#11 @zodiac1978
4 days ago

I'm a little bit disappointed about the lack of specific feedback. Like I already mentioned these entries would just show up if there are files with these mime types uploaded.

I have tried to categorize all mime types for which uploading is allowed. Maybe it would have been better to wait for the discussion about these categories. Or I should have made a suggestion about just the useful categories, but I thought I should solve the bigger picture. Maybe I was wrong.

In the description of the ticket I made a first suggestion about this grouping.

These are the allowed mime types:

Images, Audio and Video is the status quo of the grouping:

I am not sure if the categories used in the wp_get_mime_types inline docs are a good idea:
Image formats, Video formats, Text formats, Audio formats, Misc application formats, MS Office formats, OpenOffice formats, WordPerfect formats, iWork formats

Maybe the groups used in the wp_get_ext_types are better:

These would be:
image, audio, video, document, spreadsheet, interactive, text, archive, code

The first three are already used. We could add Documents. This seems to be widely accepted in the Slack. More questions / notices from Slack:

Interesting idea from @mikeschroder :

I think more around making it easy to sort by them in the media modal

Sorting would be great too. My use case is: I have uploaded a PDF and want to find it. I could search for ".pdf", but maybe using the dropdown is faster and more easy.

Issue mentioned from @karmatosed :

To me that list will only continue to grow.

I don't think, because this would handle all allowed mime types and if more mime types are added they could be added to one of the existing groups (like the the ebook mime types mentioned above) which could be added to Documents.

And another question from @karmatosed :

Do we know any examples that have solved this?

Yes, there are some plugins:

The most notable ones are these I think:
https://wordpress.org/plugins/media-library-assistant/ (adds Text and Applications which seems to be quite confusing)
https://wordpress.org/plugins/enhanced-media-library/ (adds Documents and PDFs)

Most of the other plugins are just adding specific mime types and are not setting these groups.

Like https://wordpress.org/plugins/mime-types-plus/ - but this is using the same grouping as wp_get_ext_types on their settings screen.

Some plugins are adding specific new groups for their use case (like Favicon Images, PDFs, Avatar Images, CSV for products, XML, GPX data, etc.)

All plugins using the filter can be found here:

This search is even more helpful to get faster access to the added groups:

Most plugins are adding PDFs. Or newly added extensions, but I found some plugins which have added more groups, like this ticket is suggesting.


All of theme using some variation sets of Archives/ZIPs/RARs/TARs, Documents/Docs, Office, OpenOffice, Excel, PDFs, etc. - But I think we should use generic naming and not something app/company specific, like MS Office or OpenOffice.

An one more issue from @karmatosed :

web-document to me just feels weird wording too.

This was my first suggestion. This could be "Text" or "Code" (belongs to the actual mime type). But I'm fine with adding just one or some few of them. For my use case Documents would be totally sufficient. Archives could be helpful too. I haven't uploaded any HTML or CSS file to media ... And Text, Spreadsheets and Interactives could be added to Documents too. Then we would have:
Images, Audio, Video, Documents, Archives

And one last from @karmatosed :

I’ll add my voice to ticket as I feel just get documents in then iterate is a win.

Maybe this is a language problem (I'm not a native English speaker), but I doesn't felt encouraged to to do so after the last comment. Re-thinking the UI looked like something which has to be done before this ticket can go further, so I stopped working it. But there was no discussion about re-thinking the UI ...

But maybe this research helps us to move further now. Any feedback is much appreciated.

Note: See TracTickets for help on using tickets.