-
-
Save camaleaun/05d33fb819ed8d6f6d856eb2262ea5db to your computer and use it in GitHub Desktop.
Wordpress Allow Custom Font Upload
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 | |
/** | |
* Allow fonts upload | |
* | |
* @param array $mime_types Current allowed mime types. | |
* @return array $mime_types Modified mime types. | |
*/ | |
function allow_upload_fonts_mimes_types( $mime_types ) { | |
$mime_types = array_merge( | |
$mime_types, | |
apply_filters( | |
'fonts_mime_types', | |
array( | |
'otf' => 'application/vnd.ms-opentype', | |
'woff' => 'application/x-font-woff', | |
'woff2' => 'application/x-font-woff', | |
'ttf' => 'font/sfnt', | |
'svg' => 'image/svg+xml', | |
'eot' => 'application/vnd.ms-fontobject' | |
) | |
) | |
); | |
return $mime_types; | |
} | |
add_filter( 'upload_mimes', 'allow_upload_fonts_mimes_types' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment