DIVI

Add Woff Support to Divi

Last updated 3 months ago

PHP
/**
* Add WordPress Custom MIME Type Support.
* $mimes Array of MIME Types.
*
*/
function hlabs_custom_mime_types( $mimes ) {
  $mimes['otf']    = 'application/x-font-opentype';
  $mimes['woff']   = 'application/font-woff';
  $mimes['woff2']  = 'application/font-woff2';
  return $mimes;
}
add_filter('upload_mimes', 'hlabs_custom_mime_types', 999999);


/*
* Add Custom Font Type Support to Divi.
*/
function custom_font_formats() {
  return array('otf', 'woff', 'woff2');
}
add_filter('et_pb_supported_font_formats', 'custom_font_formats', 1);
PHPCS Compliant

All code snippets are licensed GPLv2 or later unless otherwise stated.