If you have a child theme, you can put it in its functions.php. If you don’t have a child theme, use the code snippet plugin or something similar.
Pay attention to the exact spelling of the code. Here in the forum, the inverted commas are misspelled in your post. I don’t know if this is due to your source for the code or the lack of formatting as a code block in your post. The code should actually look like this:
add_filter( 'eml_supported_mime_types', function( $list ) {
$list['audio/mp3'] = array(
'label' => 'MP3 Audio',
'ext' => 'mp3'
);
return $list
} );
Thanks for the quick reply. I have installed the code snippet plugin. Now I get a syntax error when I enter the code.
Parse Error : syntax error , unexpected ‘}’, expecting ‘;’ on line 7
Ah, yes, there is a “;” missing. Corrected:
add_filter( 'eml_supported_mime_types', function( $list ) {
$list['audio/mp3'] = array(
'label' => 'MP3 Audio',
'ext' => 'mp3'
);
return $list;
} );
Now the snippet plugin is working. If I now want to load an mp3 file from a Dropbox into the media library, the following error message appears:
The specified URL https://www.dropbox.com/…………. responds with an invalid content-type text/html; charset=utf-8.
This obviously doesn’t work because the URL you entered is an HTML page and not an MP3 file. To do this, dropbox.com would have to provide you with such a direct URL. According to their documentation, this is possible with an additional parameter in the URL: https://help.dropbox.com/de-de/share/force-download
Unfortunately I haven’t made any progress. In the Dropbox, I used “dl=1” and “raw=1” as query parameters in the link. In both cases I get the error message: The specified URL https://www.dropbox.com/*&raw=1 responds with http-status 302.
I have tried another puplic folder in another cloud and I get the error: The specified URL https://filedn.eu/.mp3 responds with http-status 404.
What am I doing wrong?
The URLs you are using apparently do not return any importable files. A http-status 404 means the file does not exist.
You can test it e.g. with https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf – this must work as this importable file is directly accessible.
For files that you want to import this way, you need exactly such URLs. They must refer directly to the file.
Now I have found the solution. The content type is not audio/mp3 but audio/mpeg.
add_filter( ’eml_supported_mime_types’, function( $list ) {
$list[‘audio/mpeg’] = array(
‘label’ => ‘MP3 Audio’,
‘ext’ => ‘mp3’
);
return $list;
} );
Great if you have found a solution. For me, this points to a faulty content type on the part of the URLs you are using. But it is of course also a solution.
You are welcome to set the topic to solved once it has been clarified for you.
The problem with the URL was spaces in the file name. Now everything works great. Thank you for your patience.