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

enter image description here

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

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.

Read more here:: Restrict file types in the uploader of a wp.media frame

Leave a Reply

Your email address will not be published. Required fields are marked *