Adding Additional mime_types

I’m running trying to add additional mime types to a Local nginx WordPress install.
Regardless of the type I add to my functions.php file, none of those types of files are selectable in the media browser. In my case, text/vtt, video/ogg, and video/webm

I followed this:

Same thing happens when I go the plugin route:

So, how does one add mime_types to a Local By Flywheel nginx installation?

Hey @Dario

When you say that “none of those types of files are selectable in the media browser” do you mean that you are unable to successfully add those kinds of media to WordPress?

If you have an error message that you are receiving, or a screenshot of what you are seeing that can be helpful for troubleshooting.

You mentioned that you were looking at that wpbeginner.com article – do you have the specific code that you added to your functions.php file? If you do, can you include the relevant parts here for us to take a look?

Let me know what you find!

– Ben

Hi Ben!
No error message appears. I just cannot select files in the media upload dialog that are ogg, webm, or vtt. I can see them in the window, but cannot click on them.

I can succeed on another site (run through MAMP Pro and using Apache), but no luck using Local with the default install (nginx).
A little surfing shows that I need to add some allow lines to the nginx files, but using the default install I cannot seem to access those.

Here’s the basic code for the functions.php file (using svgs instead of the ones I’m after):

function my_myme_types($mime_types){
$mime_types[‘svg’] = ‘image/svg+xml’; //Adding svg extension
return $mime_types;
}
add_filter(‘upload_mimes’, ‘my_myme_types’, 1, 1);

Then again, looking here I see that ogg and webm are allowed (though not vtt). That’s odd, because I cannot select either when I try to upload media ,
https://codex.wordpress.org/Function_Reference/get_allowed_mime_types

-Darren

That sounds like something else is preventing it from uploading.

I just tried uploading an .ogg file to one of my Local sites and it uploaded just fine.

What browser are you using to administer these sites?

Also, how large are the files that you are trying to upload?

– Ben

Hi Ben,
Safari.
The files are less than 2Mb.

That said, just now I went into Chrome and tried.
Chrome gives me a format upload option to choose between ‘Custom Files’ and ‘All Files’.
Trying that now I can upload the VTT file!

Thanks!
-Darren

That’s interesting that Safari doesn’t let you upload those files. I’m glad you figured it out though!