[wp-trac] [WordPress Trac] #32544: No function exposes all supported MIME types

WordPress Trac noreply at wordpress.org
Mon Jun 8 13:22:24 UTC 2015


#32544: No function exposes all supported MIME types
----------------------------------------+------------------------------
 Reporter:  dan.rossiter                |       Owner:
     Type:  enhancement                 |      Status:  new
 Priority:  low                         |   Milestone:  Awaiting Review
Component:  Media                       |     Version:  4.2.2
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:
----------------------------------------+------------------------------

Comment (by ipm-frommen):

 To me, it is not clear what the desired functionality exactly is.

 Since the `upload_mimes` filter passes the current user ID, there is no
 way to include all MIME types, for every possible user.

 For example, a plugin could use the above filter as well as the user ID
 like so:

 {{{
 add_filter( 'upload_mimes', 'user_mimes', 10, 2 );

 function user_mimes( $mimes, $user_id ) {

     $user = get_userdata( $user_id );
     if ( $user && $user->user_firstname === 'Abe' ) {
         $mimes[ 'foo' ] = 'text/foo';
     }

     return $mimes;
 }
 }}}

 If I understand your last sentence correctly, you would like to have
 `'foo'` included in the result of your desired `wp_get_all_mime_types`
 function. Is this correct? If so, this is not possible.

 Also, your example code is wrong (there is an endless loop).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32544#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list