Created
February 6, 2017 14:30
-
-
Save Gkiokan/5b9e14bd3aff3add191d9ce1b62cea18 to your computer and use it in GitHub Desktop.
WP 4.7.1+ SVG Broken Upload errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
SVG fix for 4.7.1+ | |
*/ | |
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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment