Restrict file types in the uploader of a wp.media frame

When creating a wp.media frame in JS, is it possible to specify allowed file types for the uploads tab?

enter image description here

wp.media({
    title: 'Pick a PDF',
    button: {
        text: 'Use this file...'
    },
    library: {
        type: 'application/pdf'
    },
    multiple: false,

    // Is there a similar option to this that works?
    uploader: {
        type: 'application/pdf'
    }
}

Note: I do not want to restrict all upload mime types through the upload_mimes hook. This should be only an indication to user, since the library already filters the files by mime type (the library.type option).

The documentation is kind of short-spoken on this topic at the moment.

0

Leave a Comment