Last active
January 19, 2024 16:36
-
-
Save michaelbourne/905b2ca43f51eb6dd746acf1c4a47884 to your computer and use it in GitHub Desktop.
Add support for WOFF and WOFF2 file uploads in WordPress
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 | |
// The following code goes in your functions.php file of a Child Theme | |
function custom_font_mime_types($mimes = array()) { | |
$mimes['woff'] = 'application/x-font-woff'; | |
$mimes['woff2'] = 'application/x-font-woff2'; | |
// Depending on your server setup, you may need to use these instead: | |
//$mimes['woff'] = 'font/woff'; | |
//$mimes['woff2'] = 'font/woff2'; | |
return $mimes; | |
} | |
add_filter('upload_mimes', 'custom_font_mime_types'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment