1

I'm using wp.media() to invoke the WordPress media library modal in a custom taxonomy. In the pop up I only want to display zip files. I know I can limit the media library to just audio or video using those keywords but there doesn't seem to be a comprehensive list of "types" anywhere.

How would I get wp.media() to only display zip files?

Currently I have:

// Sets up the media library frame
meta_image_frame = wp.media.frames.meta_image_frame = wp.media({
    title: meta_term_image.title,
    button: { text:  meta_term_image.button },
    library: { type: "zip"}
});

Needless to say type: "zip" doesn't work. However type: "audio" works just fine.

  • 3
    Zip looks like it's actually a sub-type of application. Have you tried type: 'application/zip'? – Jami Gibbs Dec 27 '16 at 16:08
  • 1
    That does it thanks! I hadn't realised it just referred to MIME Types. Do you want to provide that as an answer? – Ralphonz Dec 28 '16 at 9:05
  • I wasn't certain it would work but glad to hear it did! I've add my answer. – Jami Gibbs Dec 28 '16 at 12:27
2

The zip files are in a subtype called application so you should try using:

type: 'application/zip'

A list of default allowed mime types is available from wp_get_mime_types.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.