Unset mp4 Mime
-
Attempting to unset the mp4 Mime so editors can not upload video files to the server. Have added this function to the child theme’s function file.
function my_mime_types($mime_types){
if (!current_user_can(‘editor’)) {
return;
}
unset($mime_types[‘mp4’]); // Removes the .mp4 extension
return $mime_types;
}
add_filter(‘upload_mimes’, ‘my_mime_types’, 1, 1);but editor’s can still upload mp4 files.
if substitute pdf for mp4 like this
function my_mime_types($mime_types){
if (!current_user_can(‘editor’)) {
return;
}
unset($mime_types[‘pdf’]); // Removes the .pdf extension
return $mime_types;
}
add_filter(‘upload_mimes’, ‘my_mime_types’, 1, 1);function works and returns this error “Sorry, you are not allowed to upload this file type.”
Any ideas as why the mp4 function does not work?
- The topic ‘Unset mp4 Mime’ is closed to new replies.