I’m using a filter in my theme to explicitly allow svg uploads:
add_filter( 'wp_check_filetype_and_ext', function($filetype_ext_data, $file, $filename, $mimes) {
if ( substr($filename, -4) === '.svg' ) {
$filetype_ext_data['ext'] = 'svg';
$filetype_ext_data['type'] = 'image/svg+xml';
}
return $filetype_ext_data;
}, 100, 4 );
Seems a little safer than ALLOW_UNFILTERED_UPLOADS
and doesn’t require updates to core files.
-
This reply was modified 8 years, 2 months ago by bookwyrm. Reason: code formatting