#43511 closed defect (bug) (invalid)
Uploading additional mime type file doesn't show in the media REST endpoint
Reported by: | dingo_d | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.1 |
Component: | REST API | Keywords: | |
Focuses: | rest-api | Cc: |
Description
I enabled yaml
mime type in my plugin because I need to upload yaml
files in the admin.
<?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?
Change History (4)
#2
@
7 years ago
- Resolution set to invalid
- Status changed from new to closed
You're right, when I test this on the develop version, it shows.
My bad, I'll have to find out what is blocking it.
Note: See
TracTickets for help on using
tickets.
Hi @dingo_bastard, did you test this on a vanilla install?
I just tested this and I can see my
test.yaml
file as the first item in/wp-json/wp/v2/media
.I don't see any post mime type filtering for
/wp-json/wp/v2/media
, unless we use e.g./wp-json/wp/v2/media?media_type=application
.This seems to be the post mime type filtering setup in
WP_REST_Attachments_Controller::prepare_items_query
: