Skip to content

Instantly share code, notes, and snippets.

@lucas-pelton
Forked from jamesdixon/custom-fonts.php
Created May 3, 2019 18:38
Show Gist options
  • Save lucas-pelton/4e17b386c56507b12effc948900427cb to your computer and use it in GitHub Desktop.
Save lucas-pelton/4e17b386c56507b12effc948900427cb to your computer and use it in GitHub Desktop.
Wordpress Allow Custom Font Upload
<?php
// add to your theme's functions.php file
add_filter('upload_mimes', 'add_custom_upload_mimes');
function add_custom_upload_mimes($existing_mimes) {
$existing_mimes['otf'] = 'application/x-font-otf';
$existing_mimes['woff'] = 'application/x-font-woff';
$existing_mimes['ttf'] = 'application/x-font-ttf';
$existing_mimes['svg'] = 'image/svg+xml';
$existing_mimes['eot'] = 'application/vnd.ms-fontobject';
return $existing_mimes;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment