WordPress blocks several file types by default, including SVG, WOFF, WOFF2, and TTF files. While this is done for security reasons, developers and designers often need these formats for custom icons, logos, typography, and modern web design projects.

If you’ve ever tried uploading an SVG or font file to the WordPress Media Library, you’ve probably seen the error:

“Sorry, this file type is not permitted for security reasons.”

In this guide, you’ll learn multiple ways to enable SVG and font uploads in WordPress safely.


Why WordPress Blocks SVG and Font Files

WordPress only allows a limited set of MIME types to reduce security risks. SVG files are especially restricted because they can contain embedded JavaScript or malicious code.

However, if you manage your own website or work with trusted files, enabling these formats is completely normal in many development workflows.

Common use cases include:

  • Uploading SVG logos
  • Using custom icon libraries
  • Self-hosting web fonts
  • Adding custom typography to Elementor or Gutenberg
  • Improving performance with lightweight vector graphics

Method 1: Allow SVG and Font Uploads Using Code

This is the most lightweight and developer-friendly solution.

Add the following code to your theme’s functions.php file or a custom plugin.

/**
 * Allow SVG, WOFF, WOFF2, and TTF mime types in WordPress
 */
add_filter( 'upload_mimes', function ( $mimes ) {

    $mimes['svg']   = 'image/svg+xml';
    $mimes['woff']  = 'font/woff';
    $mimes['woff2'] = 'font/woff2';
    $mimes['ttf']   = 'font/ttf';

    return $mimes;
});