How to Fix ‘Sorry, This File Type Is Not Permitted’ in WordPress

You're trying to upload a file to your WordPress Media Library — a PDF, an SVG logo, a ZIP archive, an audio file, or maybe a custom font — and instead of uploading, WordPress stops you with this message:

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

Frustrating? Absolutely. But also completely fixable.

WordPress intentionally restricts which file types can be uploaded through the Media Library. This is a security feature — not a bug. But there are many legitimate reasons you might need to upload file types WordPress doesn't allow by default, and there are several safe, proven methods to enable them.

This guide covers every method to fix the "Sorry, this file type is not permitted" error in WordPress — from quick code snippets to plugin-based solutions — along with guidance on which file types you can safely allow and which ones to avoid.

Why Does WordPress Block Certain File Types?

WordPress maintains an internal allowlist of file types that can be uploaded through the Media Library. Any file type not on this list is automatically blocked — regardless of the file's actual content.

This is a deliberate security measure. Allowing unrestricted file uploads is one of the most common vectors for website attacks. A malicious user who can upload a PHP file, for example, could potentially execute code on your server and take complete control of your site.

So WordPress's caution is well-founded. That said, there are plenty of completely safe file types — SVG files, PDF documents, custom fonts, audio files, and more — that WordPress blocks by default simply because they weren't on the original allowlist when the CMS was first built.

Default allowed file types in WordPress include:

  • Images: .jpg, .jpeg, .png, .gif, .webp, .ico, .bmp, .tiff
  • Documents: .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .odt
  • Audio: .mp3, .m4a, .ogg, .wav
  • Video: .mp4, .m4v, .mov, .wmv, .avi, .mpg, .ogv
  • Archives: .zip, .gz, .tar

Commonly blocked file types people need to upload:

  • .svg — Vector graphics, logos, icons
  • .webp — Modern image format (blocked in older WordPress versions)
  • .avif — Next-gen image format
  • .ttf, .otf, .woff, .woff2 — Custom web fonts
  • .json — Data files, Google Site Verification, schema files
  • .xml — Data exports, feeds
  • .csv — Spreadsheet data
  • .eps — Vector graphics
  • .psd — Photoshop files
  • .ai — Adobe Illustrator files
01
Add Allowed File Types via functions.php (Recommended)

The cleanest, most flexible way to add new file types to WordPress is by hooking into the upload_mimes filter in your theme's functions.php file — or better yet, in a simple custom plugin.

Step 1: Access your theme's functions.php

  1. Log in to your WordPress dashboard
  2. Go to Appearance → Theme File Editor
  3. Select functions.php from the right-hand file list
  4. Scroll to the very bottom of the file

Or connect via FTP and open /wp-content/themes/your-active-theme/functions.php in a text editor.

Step 2: Add allowed file types

Add this code snippet to the bottom of functions.php:

PHP
function acemindtech_allow_file_types( $mimes ) {
    // Allow SVG files
    $mimes['svg']  = 'image/svg+xml';
    $mimes['svgz'] = 'image/svg+xml';

    // Allow font files
    $mimes['ttf']   = 'font/ttf';
    $mimes['otf']   = 'font/otf';
    $mimes['woff']  = 'font/woff';
    $mimes['woff2'] = 'font/woff2';

    // Allow JSON and XML
    $mimes['json'] = 'application/json';
    $mimes['xml']  = 'application/xml';

    // Allow CSV
    $mimes['csv'] = 'text/csv';

    return $mimes;
}
add_filter( 'upload_mimes', 'acemindtech_allow_file_types' );

Only add the file types you actually need. Remove lines for any types you don't require.

Step 3: Save and test

Save the file and try uploading the previously blocked file type again. It should now upload successfully.

Important: Always edit functions.php with extreme care. A single syntax error will break your site. If you're not comfortable editing theme files, use Method 2 (plugin) instead. Also consider using a child theme so your changes aren't overwritten when the parent theme updates.
02
Use a Plugin (Easiest for Non-Developers)

If you'd rather not touch code, there are several reliable plugins that handle this for you:

WP Extra File Types (free, from wordpress.org)

This is the simplest dedicated plugin for this problem:

  1. Go to Plugins → Add New and search for "WP Extra File Types"
  2. Install and activate it
  3. Go to Settings → Extra File Types
  4. Check the boxes next to the file types you want to allow
  5. Click Save Changes

Done. No code required.

SVG Support (free, from wordpress.org)

If your specific problem is uploading SVG files:

  1. Install and activate SVG Support
  2. Go to Settings → SVG Support
  3. Enable SVG support for administrators, editors, or all users as needed
  4. Optionally enable "Sanitize SVG on upload" for additional security

SVG Support also handles safe sanitization of SVG files on upload — an important security consideration covered in detail below.

03
Add a File Type Check Override in wp-config.php

WordPress 5.1 and later includes a constant you can define in wp-config.php to disable the file type security check entirely. This is the most permissive option — use it only in controlled environments where you fully trust everyone with upload access.

Open wp-config.php via FTP and add this line just before the /* That's all, stop editing! */ comment:

PHP
define( 'ALLOW_UNFILTERED_UPLOADS', true );
⚠️ Important warning: This constant completely disables WordPress's file type checking. It allows any file type to be uploaded — including PHP files and other potentially dangerous formats. Only use this on:
  • A local development environment
  • A staging site
  • A production site where only fully trusted administrators have upload access and you have additional server-level security in place

Never use ALLOW_UNFILTERED_UPLOADS on a site where clients, contributors, or untrusted users have upload permissions.

04
Fix SVG Files Specifically (Extra Steps Required)

SVG files deserve their own section because they're the most commonly needed blocked file type — and the most security-sensitive.

Unlike a JPEG or PNG, an SVG file is XML-based and can contain embedded JavaScript. This means a malicious SVG file could potentially execute scripts in a visitor's browser if displayed directly. For this reason, simply adding SVG to the allowed MIME types (as in Method 1) is not quite enough for a production site — you should also sanitize SVG files on upload.

Safe SVG plugin (recommended approach for SVGs):

  1. Install and activate Safe SVG plugin (free, from wordpress.org)
  2. It automatically adds SVG to the allowed file types
  3. It sanitizes every SVG file on upload — stripping any embedded scripts or malicious code
  4. It also renders SVG files correctly as image previews in the Media Library

This is the safest and most complete solution for SVG uploads. No additional code required.

Manual approach (if you prefer code over plugin):

Add SVG to allowed MIME types as in Method 1, plus add a sanitization function:

PHP
function acemindtech_sanitize_svg( $file ) {
    if ( $file['type'] === 'image/svg+xml' ) {
        $dirty = file_get_contents( $file['tmp_name'] );
        // Remove script tags and event handlers
        $clean = preg_replace( '//i', '', $dirty );
        $clean = preg_replace( '/on\w+="[^"]*"/i', '', $clean );
        file_put_contents( $file['tmp_name'], $clean );
    }
    return $file;
}
add_filter( 'wp_handle_upload_prefilter', 'acemindtech_sanitize_svg' );

For production sites, the Safe SVG plugin's sanitization is more thorough than a simple regex — it uses a full SVG sanitizer library. Use the plugin over the manual approach for anything other than local development.

05
Fix the Error for a Specific Upload via MIME Type Verification

In WordPress 4.7.1 and later, an additional layer of security was added: WordPress now verifies that a file's actual MIME type matches its extension — not just that the extension is on the allowlist.

This means that even after adding a file type to the upload_mimes filter, you may still get the error if WordPress's MIME type detection doesn't match the extension. This is especially common with SVG, JSON, and certain font files.

Fix with the wp_check_filetype_and_ext filter:

Add this to functions.php alongside your MIME type additions:

PHP
function acemindtech_fix_mime_type_check( $data, $file, $filename, $mimes ) {
    $ext     = pathinfo( $filename, PATHINFO_EXTENSION );
    $ext     = strtolower( $ext );

    $allowed = array(
        'svg'   => 'image/svg+xml',
        'svgz'  => 'image/svg+xml',
        'json'  => 'application/json',
        'xml'   => 'application/xml',
        'woff'  => 'font/woff',
        'woff2' => 'font/woff2',
        'ttf'   => 'font/ttf',
        'otf'   => 'font/otf',
    );

    if ( isset( $allowed[$ext] ) ) {
        $data['ext']  = $ext;
        $data['type'] = $allowed[$ext];
    }

    return $data;
}
add_filter( 'wp_check_filetype_and_ext', 'acemindtech_fix_mime_type_check', 10, 4 );

This tells WordPress exactly what MIME type to assign to each of these extensions, bypassing the automatic detection that can sometimes fail.

06
Fix the Error on WordPress Multisite

On a WordPress Multisite network, file upload restrictions are controlled at two levels: the network level and the individual site level. Even if you've added file types using the methods above, Multisite has an additional setting that must be configured by the Network Admin.

Step 1: Log in as Network Admin

  1. Go to yournetwork.com/wp-admin/network/ (Network Admin dashboard)
  2. Go to Settings → Network Settings

Step 2: Update the Upload File Types setting

Scroll down to the "Upload Settings" section. You'll see a field labelled "Upload file types" containing a space-separated list of allowed extensions (e.g., jpg jpeg png gif).

Add your desired file type extensions to this list, separated by spaces:

TEXT
jpg jpeg png gif pdf svg svgz ttf otf woff woff2 json xml csv

Click Save Changes.

Step 3: Apply functions.php fix as well (if needed)

The Multisite settings control what the admin UI shows, but MIME type filtering still applies underneath. If you're still getting errors after updating Multisite settings, also add the upload_mimes filter from Method 1 to your theme's functions.php or a network-activated plugin.

Which File Types Are Safe to Allow?

Here's a practical guide to which file types you can safely enable and which require extra caution:

Safe to allow freely:

File Type Extension Notes
PDF.pdfSafe, widely needed
Web fonts.ttf .otf .woff .woff2Safe, no execution risk
JSON.jsonSafe when uploaded by trusted admins only
CSV.csvSafe, no execution risk
Audio.flac .aacSafe media files
Vector images.eps .aiSafe if only admins upload

Allow with caution (sanitize on upload):

File Type Extension Risk Mitigation
SVG.svgCan contain embedded JavaScriptUse Safe SVG plugin to sanitize
XML.xmlCan reference external entitiesRestrict to admin-only upload
HTML.html .htmCan contain scriptsAvoid unless absolutely necessary

Never allow on a production site:

File Type Extension Why
PHP.php .php3 .phtmlCan execute server-side code
JavaScript.jsCan execute client-side scripts
Shell scripts.sh .bashCan execute system commands
Executable.exe .batMalware risk
Python/Ruby.py .rbCan execute server-side code

Troubleshooting: Still Getting the Error After Applying a Fix?

If you've added a file type to upload_mimes but the error persists, here are the most common reasons:

  • Your changes aren't in the active theme. If you added code to a parent theme's functions.php but a child theme is active, or vice versa, your code won't run. Make sure you're editing the currently active theme, or use a site-specific plugin instead.
  • A security plugin is overriding your settings. Plugins like Wordfence, iThemes Security, and All In One WP Security have their own file upload restrictions that can override the upload_mimes filter. Check your security plugin settings and whitelist the file type there as well.
  • MIME type detection is failing. As covered in Method 5, WordPress's automatic MIME type detection can fail for certain file types. Use the wp_check_filetype_and_ext filter from Method 5 alongside your upload_mimes changes.
  • You're on Multisite and haven't updated Network Settings. See Method 6 — Multisite has a separate layer of file type control.
  • The file itself is corrupted or misnamed. A file with the wrong extension (e.g., a PNG file renamed to .svg) will fail both the extension check and the MIME type verification. Make sure your file is genuinely the type its extension claims.
  • Your hosting provider has server-level upload restrictions. Some hosting providers — particularly those with aggressive security configurations — block certain file types at the server level, completely independently of WordPress. If nothing else works, contact your hosting provider and ask whether they have server-level upload restrictions in place.

Best Practices for WordPress File Uploads

  • Only allow file types you genuinely need. Don't add a blanket allowance for every file type — only enable the specific extensions your site requires.
  • Restrict who can upload. In WordPress, you can control upload capabilities by user role. If you need to allow SVG or other sensitive file types, consider restricting upload permissions to Administrator and Editor roles only, not Contributors or Subscribers.
  • Always sanitize SVG files. Never allow SVG uploads without sanitization. Use the Safe SVG plugin or an equivalent sanitization function.
  • Use a child theme for functions.php edits. Any changes you make to a parent theme's functions.php will be erased when the theme updates. Always use a child theme or a site-specific plugin for code customizations.
  • Test uploads in a staging environment first. Before changing file upload settings on a live site, test in a staging environment to make sure the changes work correctly and don't introduce unexpected behaviour.
  • Keep a security plugin active. A good security plugin (Wordfence, Sucuri, etc.) provides an extra layer of protection against malicious uploads even if you've expanded your allowed file types.

Quick Reference: File Type Fix Summary

Situation Best Fix
Need to allow one or two file typesAdd to upload_mimes filter in functions.php
Not comfortable with codeUse WP Extra File Types plugin
Need to allow SVG specificallyInstall Safe SVG plugin
Still getting error after upload_mimes fixAdd wp_check_filetype_and_ext filter (Method 5)
WordPress Multisite networkUpdate Upload File Types in Network Settings
Completely trusted admin-only environmentDefine ALLOW_UNFILTERED_UPLOADS in wp-config.php
Security plugin blocking uploadsWhitelist file type in security plugin settings too

Frequently Asked Questions

Q: Is it safe to allow SVG uploads in WordPress?
A: SVGs can be safe if you sanitize them on upload. Never simply add SVG to the allowed MIME types without sanitization — use the Safe SVG plugin, which strips potentially malicious code from every SVG file before it's saved to your server.
Q: Why does WordPress block file types in the first place?
A: To prevent malicious file uploads. If an attacker could upload a PHP or shell script file, they could potentially execute code on your server. WordPress's allowlist approach means only known-safe file types are accepted by default.
Q: Will adding file types to upload_mimes affect my site's security?
A: It depends on the file type. Adding fonts, PDFs, and CSVs carries minimal risk. Adding SVG, HTML, or XML carries more risk and requires additional precautions. Adding PHP or executable files would be a serious security mistake.
Q: My client needs to upload PDFs but PDF is already allowed. Why are they getting an error?
A: PDF is on WordPress's default allowlist, so if a client is getting an error for a PDF, the likely culprits are: a security plugin blocking the upload, a server-level restriction, or the file being too large (exceeding the PHP upload_max_filesize limit). Check your security plugin settings and PHP upload limits.
Q: Can I allow file uploads on a per-user-role basis?
A: Yes, with the right plugin. The Members plugin or User Role Editor can modify upload capabilities by role. Alternatively, you can add a role check inside your upload_mimes filter function to only allow certain file types for specific roles.

Final Thoughts

The Sorry, this file type is not permitted" error in WordPress is a security feature doing its job — but that doesn't mean it can't be worked around safely for legitimate file types.

For most situations, adding allowed MIME types in functions.php or using a plugin like WP Extra File Types will resolve the issue in minutes. For SVG files specifically, pair your fix with the Safe SVG plugin to keep your site secure while gaining full SVG support.

The key principle throughout: only allow what you need, sanitize where there's risk, and never allow executable file types on a production site.

Need help configuring file upload settings safely on your WordPress site? Our development team handles custom WordPress configurations every day — we'll get your uploads working without compromising your site's security.

Contact us today and we'll sort it out.
Views: 190