Created
March 28, 2019 17:47
-
-
Save itzmekhokan/925d8a4d00c6938ecabbb6748dab0317 to your computer and use it in GitHub Desktop.
to handle file types not permitted for security reasons
This file contains hidden or 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 | |
function add_allow_upload_extension_exception( $types, $file, $filename, $mimes ) { | |
// Do basic extension validation and MIME mapping | |
$wp_filetype = wp_check_filetype( $filename, $mimes ); | |
$ext = $wp_filetype['ext']; | |
$type = $wp_filetype['type']; | |
if( in_array( $ext, array( 'ai', 'eps' ) ) ) { // if follows illustrator files have | |
$types['ext'] = $ext; | |
$types['type'] = $type; | |
} | |
return $types; | |
} | |
add_filter( 'wp_check_filetype_and_ext', 'add_allow_upload_extension_exception', 99, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment