Use WordPress’s upload_mimes filter to add only the extension and MIME type you need. Put the code in a small custom plugin or a site-specific integration so theme updates cannot remove it. For example, this enables SVG uploads:
<?php
function my_custom_mime_types( $mimes ) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter( 'upload_mimes', 'my_custom_mime_types' );
Save the file, activate the plugin, and retry the upload. If it still fails, check the user’s capability, Multisite settings, and server or security rules.
What the upload_mimes filter does
WordPress builds its allowed upload list with get_allowed_mime_types(). That function starts with WordPress’s MIME map, removes SWF and executable mappings, applies restrictions for users who lack the relevant capability, and then runs the upload_mimes filter.
Your callback receives the existing extension-to-MIME map. Add one entry and return the map unchanged otherwise:
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['extension'] = 'correct/mime-type';
return $mimes;
} );
Use the MIME type for the actual file format, not a value guessed from its name. WordPress uses the extension patterns and MIME mappings when wp_check_filetype() validates an upload.
Where to put the code safely
Recommended: a small custom plugin
Create a PHP file in wp-content/plugins/, beginning with a plugin header, then add the filter:
<?php
/**
* Plugin Name: Site Upload MIME Types
*/
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['webp'] = 'image/webp';
return $mimes;
} );
In the dashboard, open Plugins → Installed Plugins and activate the plugin. A custom plugin or mu-plugin keeps the setting independent of the active theme.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Site-specific theme integration
A site-specific integration can also contain the filter. Avoid editing a parent theme: an update can overwrite the change. If a child theme is used, remember that the filter disappears when the child theme is changed or disabled.
Common file-type mappings
Use a mapping that corresponds to the real format. Add only the entries your site needs.
| Extension | MIME type | Typical consideration |
|---|---|---|
svg |
image/svg+xml |
Active XML content; allow only for trusted files or sanitize before serving. |
json |
application/json |
Useful for data imports and configuration files; validate contents before processing. |
webp |
image/webp |
Modern image format; confirm that image-processing tools on the host support it. |
csv |
text/csv |
Treat imported values as untrusted data, especially when opening them in spreadsheet software. |
html |
text/html |
Active content; generally restrict uploads to trusted administrators and store or serve carefully. |
js |
text/javascript |
Executable in a browser; enabling it materially increases the impact of a compromised upload. |
For several types, add all entries in one callback:
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['svg'] = 'image/svg+xml';
$mimes['json'] = 'application/json';
$mimes['webp'] = 'image/webp';
$mimes['csv'] = 'text/csv';
return $mimes;
} );
When to use mime_types instead
The mime_types filter changes WordPress’s general MIME map. WordPress documents it for adding MIME types globally. Use upload_mimes when the goal is specifically to control which files users may upload; the developer reference identifies upload_mimes as the appropriate filter for removing upload types.
Why an added type can still be rejected
User capability restrictions
WordPress removes HTML and JavaScript mappings for users who do not have the required capability. Adding a mapping does not grant that capability or bypass WordPress’s checks. Test with the same user role that will perform the upload.
Multisite network allowlist
On Multisite, check_upload_mimes() intersects the MIME list with the network administrator’s allowed extensions. A network administrator should open Network Admin → Settings → Upload File Types and add the extension there. Site-level code alone cannot override a network allowlist.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Hosting, firewall, or security-plugin rules
A web server, host control panel, Web Application Firewall, or security plugin may reject an extension after WordPress accepts its mapping. Review those logs and allow the extension only in the layer that is blocking it.
Filename and format mismatch
Check that the file really has the intended extension and is not merely renamed. A file called image.svg must contain valid SVG data; changing a different format’s filename does not make it an SVG.
Security: do not enable every file type
Do not solve an upload error with:
define( 'ALLOW_UNFILTERED_UPLOADS', true );
WordPress’s Plugin Handbook warns that this broad switch permits any file type, including PHP and other executables, and creates serious security risks. A narrow upload_mimes mapping follows least privilege and limits the exposure.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
- Enable only the extension required for a documented workflow.
- Limit the capability to trusted users where possible.
- Consider sanitization or content inspection for SVG, HTML, JavaScript, archives, and other active formats.
- Do not execute uploaded files from the uploads directory.
- Review how the file will be served, downloaded, or passed to another parser.
Step-by-step troubleshooting checklist
- Confirm the extension is spelled correctly and the file is genuinely that format.
- Verify that the mapping uses the format’s correct MIME value.
- Confirm that the plugin, mu-plugin, or integration containing the filter is active on the upload request.
- Test with a user who has the capability required for that format.
- On Multisite, add the extension under Network Admin → Settings → Upload File Types.
- Temporarily review security-plugin, WAF, host, and web-server logs for an extension or content rule.
- Retry with a small known-good file, then restore any temporary diagnostic settings.
No-code option
If you prefer a settings interface, a file-upload plugin such as WPForms File Upload Types can provide an allowlist for HTML and other extensions. Treat it as an interface for the same decision, not as a security bypass: choose only needed types, restrict trusted uploaders, and verify the plugin’s current maintenance and settings before enabling it.
Removing a type later
To remove an extension from the upload list, unset it in an upload_mimes callback:
add_filter( 'upload_mimes', function ( $mimes ) {
unset( $mimes['svg'] );
return $mimes;
} );
Existing files are not automatically deleted; this changes what can be uploaded going forward.
Quick Recap
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.
Free tools Windows power users keep installed
One-click scans. No signup required.

