[wp-trac] [WordPress Trac] #36294: Allow retrieval of WordPress media types and their extensions

WordPress Trac noreply at wordpress.org
Tue Mar 22 11:31:10 UTC 2016


#36294: Allow retrieval of WordPress media types and their extensions
-------------------------+-----------------------------
 Reporter:  flixos90     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Media        |    Version:  2.5
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 There have been a couple of occasions where I needed to access the list of
 media types and their file extensions that WordPress bundles.
 Unfortunately this list is only generated within the function
 `wp_ext2type()` and cannot be accessed from the outside.

 A use-case is when I wanted to create a file upload field in a form
 builder plugin, I would like the admin to be able to select the required
 file type, and for that I would like to use the list from that function.
 Then I could check for the extensions / their MIME types whenever an
 upload through that field would happen.

 I would propose to introduce a separate function that returns this list of
 media types and their file extensions. This function could then be called
 in `wp_ext2type()`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36294>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list