Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use WordPress’s upload_mimes filter to allow one additional extension and map it to the file’s real MIME type. Put the code in a small custom plugin or mu-plugin so it survives theme updates. Do not enable unrestricted uploads: ALLOW_UNFILTERED_UPLOADS can permit PHP and other executable files.
Add one file type with a custom plugin
The safest general approach is a narrowly scoped MIME mapping. This example allows SVG files:
<?php
/**
* Plugin Name: Site Upload MIME Types
*/
function my_custom_mime_types( $mimes ) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter( 'upload_mimes', 'my_custom_mime_types' );
Create a PHP file containing the code, place it in wp-content/plugins/, and activate it under Plugins → Installed Plugins. A site-specific or custom plugin is update-safe; editing a parent theme is not, because a theme update can overwrite the change. An mu-plugin in wp-content/mu-plugins/ is also suitable when the rule should always be active.
Free tools Windows power users keep installed
One-click scans. No signup required.
Change the extension and MIME value
Replace svg and image/svg+xml with the extension and MIME type for the format you actually use:
#1 Best Overall
- USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
- Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
- Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
- Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
- Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty
// JSON
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['json'] = 'application/json';
return $mimes;
} );
// WebP
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['webp'] = 'image/webp';
return $mimes;
} );
Other common mappings include CSV (text/csv), although the correct value can vary by format and server. WordPress’s official hook examples cover SVG, SVGZ, DOC, JSON, CSV, font formats and WebP. Use the MIME type belonging to the actual format, not a guessed value based only on the filename.
How WordPress decides whether an upload is allowed
WordPress builds its list through get_allowed_mime_types(). That process starts with the MIME map from wp_get_mime_types(), removes SWF and EXE mappings, removes HTML and JavaScript mappings for users without the relevant capability, and then applies the upload_mimes filter.
Rank #2
- High-speed USB 3.0 performance of up to 150MB/s(1) [(1) Write to drive up to 15x faster than standard USB 2.0 drives (4MB/s); varies by drive capacity. Up to 150MB/s read speed. USB 3.0 port required. Based on internal testing; performance may be lower depending on host device, usage conditions, and other factors; 1MB=1,000,000 bytes]
- Transfer a full-length movie in less than 30 seconds(2) [(2) Based on 1.2GB MPEG-4 video transfer with USB 3.0 host device. Results may vary based on host device, file attributes and other factors]
- Transfer to drive up to 15 times faster than standard USB 2.0 drives(1)
- Sleek, durable metal casing
- Easy-to-use password protection for your private files(3) [(3)Password protection uses 128-bit AES encryption and is supported by Windows 7, Windows 8, Windows 10, and Mac OS X v10.9 plus; Software download required for Mac, visit the SanDisk SecureAccess support page]
During validation, wp_check_filetype() compares the filename extension with the permitted patterns and returns the recognized extension and MIME type. A filter therefore adds an allowed mapping; it does not make a renamed or malformed file safe or valid.
When to use mime_types instead
The mime_types filter changes WordPress’s general MIME map. The developer reference describes it as the place to add types globally, while upload_mimes is the practical hook for controlling the upload allowlist (and for removing entries). For a normal “let trusted users upload this one extra format” requirement, use upload_mimes.
Rank #3
- What You Get - 2 pack 64GB genuine USB 2.0 flash drives, 12-month warranty and lifetime friendly customer service
- Great for All Ages and Purposes – the thumb drives are suitable for storing digital data for school, business or daily usage. Apply to data storage of music, photos, movies and other files
- Easy to Use - Plug and play USB memory stick, no need to install any software. Support Windows 7 / 8 / 10 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, compatible with USB 2.0 and 1.1 ports
- Convenient Design - 360°metal swivel cap with matt surface and ring designed zip drive can protect USB connector, avoid to leave your fingerprint and easily attach to your key chain to avoid from losing and for easy carrying
- Brand Yourself - Brand the flash drive with your company's name and provide company's overview, policies, etc. to the newly joined employees or your customers
Choose code or a settings plugin
| Approach | Control | Update safety | Operational considerations |
|---|---|---|---|
| Custom plugin or mu-plugin | Precise extension-to-MIME mappings; can be combined with capability checks | High when stored outside a parent theme | Requires PHP deployment and maintenance; works consistently on ordinary single sites |
| Theme code | Can add the same filter | Low for a parent theme; updates may erase it | Use only when the code is in an update-safe child theme and that dependency is intentional |
| Settings plugin | UI-based allowlist, depending on the plugin | Depends on plugin maintenance and compatibility | Useful for non-developers, but still requires correct MIME choices and security review |
For a no-code workflow, WordPress support identifies WPForms File Upload Types as an option for enabling HTML and other extensions. Check the plugin’s current maintenance, compatibility and terms before installing it. A UI does not remove the need to restrict formats and users appropriately.
Security decisions for risky formats
Allow only the smallest set of formats needed for the site. Images such as WebP are generally easier to constrain than active-content formats, but every upload should still be treated as untrusted input.
Rank #4
- GOOD VALUE PACKAGE - 1 Pack 32GB Memory Stick USB 2.0 Flash Drives with great cost performance and high quality.
- BIG CAPACITY - The available capacity: 29.10GB-29.8GB, You can save the data of movies, music, photos, designs, programs, manuals, handouts in a high speed.Good performance in digital data storing, transferring and sharing with families, friends, workmates, clients and machines.
- EASY TO USE & PLUG AND WORK - Support windows 7 / 8 / 10 / Vista / XP / 2000 / ME / NT Linux and Mac OS, Compatible with USB2.0 and below.
- TWISTTURN DESIGN & EASY CARRY - The metal clip rotates 360° round the ABS plastic body which with rubber oil skin feeling finish. The capless design can avoid lossing of cap, and providing efficient protection to the USB port.
- WARRANTY & SUPPORT - SIMMAX logo is laser printed on the USB connector surface, our products are of good quality and we promise that any problem about the product within one year since you buy.
- SVG: can contain scripts or other active content. Permit it only for trusted users and consider sanitizing SVG before display.
- HTML and JavaScript: can execute in a visitor’s browser and should be limited to a tightly controlled workflow.
- Archives and executables: can contain executable payloads or dangerous files; do not enable them merely to bypass an error.
- PHP: should not be accepted as an upload format.
Do not solve an “invalid file type” message with define( 'ALLOW_UNFILTERED_UPLOADS', true );. WordPress’s Plugin Handbook warns that this broad switch allows any file type, including PHP and other executables, and creates serious security risks. A specific upload_mimes rule is the least-privilege alternative.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteMultisite and capability limits
On WordPress Multisite, check_upload_mimes() intersects the permitted MIME list with the network administrator’s upload_filetypes setting. If the PHP filter appears correct but uploads still fail, a network administrator should open Network Admin → Settings → Upload File Types and add the extension there.
Best Value
- 【16GB Flash Drive】USB flash drives with 16GB capacity, meet your needs of daily use on work, school, home and travelling for photos, music, videos, files storage and transfer. IMEASON thumb drives can be used to store different files, easy to data backup.
- 【Metal Swivel Cap Design】USB thumb drive is metal swivel cover provides extra protection for the usb thumbdrive connector, no usb drive cap to lose; keychain design makes it easier to carry without worrying lose it.
- 【Wide Compatibility】USB drive supports Windows 7/8/10/11 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, also Supports USB 2.0 and 1.1 ports. USB Stick support TV, desktop, notebook computer, car, audio and other device. The USB Memory Stick is your great data storage and transfer companion with traveling and working.
- 【Easy to use】usb memory stick is plug and play without any software installation. Just simply plug the Flashdrive into the port of your USB-compatible devices such as computer, laptop to start data storage or transmission.
- 【What You Get】16 GB USB Flash Drive Thumb Drive, The default format of the usb storage flash drive is FAT32.
Capability checks also matter. WordPress treats HTML and JavaScript mappings differently for users who lack the relevant capability, so adding a filter does not necessarily grant every account permission to upload an active format. Keep upload privileges limited to users who need them.
Diagnose “You are not allowed to upload this file type”
- Confirm the filename. Check that the file has the intended extension, has not acquired a second extension such as
.json.txt, and is not merely a renamed file. - Verify the MIME mapping. Match the value to the real format, for example
application/jsonfor JSON orimage/webpfor WebP. - Confirm the code loads. Put it in an active custom plugin or mu-plugin and test an upload after clearing any relevant caches.
- Check the user account. The account may lack the capability required for the requested format, especially for HTML, JavaScript or other active content.
- Check Multisite settings. Ensure the extension is present in Network Admin’s Upload File Types allowlist.
- Check the hosting stack. A host, web application firewall, security plugin or web-server rule can reject an extension even after WordPress accepts its MIME mapping.
If the error changes from a WordPress file-type message to a server or firewall response, the remaining restriction is outside the MIME filter and must be addressed in that layer.
Allow several extensions in one rule
When multiple formats belong to the same site feature, keep them together in one function while retaining explicit mappings:
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['json'] = 'application/json';
$mimes['webp'] = 'image/webp';
$mimes['svg'] = 'image/svg+xml';
return $mimes;
} );
Review the list whenever the feature changes. Removing an unnecessary entry reduces the attack surface and prevents future administrators from assuming that every permitted format is safe for every user.
Quick Recap
Practical decision checklist
- Define the exact extension and its verified MIME type.
- Decide whether the format can carry active content.
- Restrict the rule to the users and workflow that need it.
- Store the code in a custom plugin or mu-plugin rather than a replaceable parent theme.
- For Multisite, obtain network-level approval and update the network allowlist.
- Test a genuine file of the format, then test a wrong or renamed file to confirm validation still behaves as expected.
- Review host, firewall and security-plugin rules if WordPress accepts the mapping but the request is blocked later.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

