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:
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.
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:
Commonly blocked file types people need to upload:
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
functions.php from the right-hand file listOr 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:
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.
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.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:
Done. No code required.
SVG Support (free, from wordpress.org)
If your specific problem is uploading SVG files:
SVG Support also handles safe sanitization of SVG files on upload — an important security consideration covered in detail below.
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:
define( 'ALLOW_UNFILTERED_UPLOADS', true );
Never use ALLOW_UNFILTERED_UPLOADS on a site where clients, contributors, or untrusted users have upload permissions.
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):
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:
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( '/