Home / Admin / Upload font files to media library
Duplicate Snippet

Embed Snippet on Your Site

Upload font files to media library

Allow the upload of font files (.ttf, .otf, .woff & .woff2) to WordPress media library

Code Preview
php
<?php
add_filter( 'upload_mimes', function( $mimes ) {
    $mimes['woff']  = 'application/x-font-woff';
    $mimes['woff2'] = 'application/x-font-woff2';
    $mimes['ttf']   = 'application/x-font-ttf';
    $mimes['svg']   = 'image/svg+xml';
    $mimes['eot']   = 'application/vnd.ms-fontobject';
    return $mimes;
} );

Comments

Add a Comment