Skip to main content
Print

Add woff and woff2 fonts to Divi

Divi 5: https://freshy.cc/share/3SFOxABRvoMirjKI50xX

source: https://alexhooley.com/divi-custom-woff-fonts/


To add WOFF & WOFF2 fonts to the Divi 4:

  1. Convert Your Font Files to WOFF & WOFF2 if not already in those formats

    Using WOFF & WOFF2 together means your font will be almost universally supported by browsers so take your old TTF files and convert them using CloudConvert.

  2. Find the core.php File & Make a Backup

    Find the wp-content/themes/Divi/includes/builder/core.php file in your website’s file system. Download a backup copy to your computer just in case.

  3. Find the Function That is Stopping WOFF & WOFF2 Uploads

    Open the core.php file and search for this function:

    function et_pb_get_supported_font_formats() { return apply_filters('et_pb_supported_font_formats', array('ttf', 'otf')); }

    Divi uses this function when uploading new fonts. As you can see it is currently set to only allow OTF and TTF fonts.

  4. Temporarily Update the Divi Core to Allow WOFF & WOFF2 Uploads

    Add the WOFF and WOFF2 formats to the array and save the file. It should look something like this:

    function et_pb_get_supported_font_formats() { return apply_filters('et_pb_supported_font_formats', array('ttf', 'otf', 'woff', 'woff2')); }

  5. Addition 10/2024:
  • edit the wp-config.php file

    After this PHP line:

    $table_prefix = 'wp_';

    Add the following line:

    define('ALLOW_UNFILTERED_UPLOADS', true);

  1. Upload the Fonts Together via the Divi Builder

    Now go back into the Divi Builder and upload the fonts in the normal way. Make sure you select the WOFF file and the WOFF2 file when you upload them.

    Your WOFF fonts should now be uploaded and working so save and exit the Divi Builder.

  2. Go Back & Undo the Changes to the core.php File

    Find the core.php file and remove WOFF and WOFF2 items from the array and save it so it looks like this again:

    function et_pb_get_supported_font_formats() { return apply_filters('et_pb_supported_font_formats', array('ttf', 'otf')); }

Table of Contents