[wp-trac] [WordPress Trac] #43511: Uploading additional mime type file doesn't show in the media REST endpoint

WordPress Trac noreply at wordpress.org
Fri Mar 9 08:54:29 UTC 2018


#43511: Uploading additional mime type file doesn't show in the media REST endpoint
---------------------------+-----------------------------
 Reporter:  dingo_bastard  |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  REST API       |    Version:  trunk
 Severity:  normal         |   Keywords:
  Focuses:  rest-api       |
---------------------------+-----------------------------
 I enabled `yaml` mime type in my plugin because I need to upload `yaml`
 files in the admin.

 {{{#!php
 <?php
 function enable_mime_types( $mimes ) {
     $mimes['svg']  = 'image/svg+xml';
     $mimes['yaml'] = 'application/x-yaml';
     return $mimes;
 }

 add_action( 'upload_mimes', 'enable_mime_types' );
 }}}

 This works in the admin, I can upload both `svg` and `yaml` files, and I
 can access them. But when I look at the `https://my-page.com/wp-
 json/wp/v2/media` I cannot see `yaml` files in the list. The `svg` shows
 fine, as well as regular `png` and `jpg` files.

 I searched in the REST handbook, but I saw no filter or action hook where
 I'd have to enable this mime type in the REST.

 Is this a bug or?

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


More information about the wp-trac mailing list