Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Use WordPress’s upload_mimes filter to allow a specific extension/MIME pair, keep the rule in a plugin or site-specific functionality module, and then test a real upload. If the site is on Multisite, a Super Admin must also permit that extension under Network Admin → Settings → Upload file types. When an upload still fails, inspect the active allowlist, the file’s actual contents, and any form, security, web-server, or hosting rules outside WordPress core.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
What a MIME type controls in WordPress
A MIME type describes the format of a file, while the extension is the suffix in its name. A JSON file normally has the .json extension and the application/json MIME value. WordPress uses an extension-to-MIME map when it decides whether an upload is acceptable; the extension alone is not the complete security decision.
As an Amazon Associate I earn from qualifying purchases.
The core map contains common image, audio, video, document, archive, and OpenDocument formats. Its contents can change with WordPress releases, so code should inspect the current map rather than assume that a type is permanently present.
wp_get_mime_types()returns the general extension-to-MIME map.get_allowed_mime_types()returns the types currently allowed for an upload context.wp_check_filetype( $filename, $mimes = null )matches a filename against a map and returnsextandtype. If there is no match, those values are false.wp_check_filetype_and_ext( $file, $filename, $mimes = null )performs the mapping and, for images, tries to determine the real MIME type. It can return a corrected image filename when the extension does not match the content.
That distinction matters: adding a name to a list does not make arbitrary bytes safe. A secure implementation allows only the formats the site needs and validates the uploaded content before it is stored or processed.
#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.
Choose the right WordPress hook
| Hook or setting | What it changes | Best use | Important limitation |
|---|---|---|---|
upload_mimes |
The upload allowlist used by a site | Adding one or more extensions, or removing an extension from uploads | It does not by itself prove that file bytes match the claimed format |
mime_types |
The general extension-to-MIME map | Adding a mapping that other WordPress code can read | WordPress documents this filter for adding types, not for removing them; use upload_mimes to restrict uploads |
| Multisite network setting | A network-wide ceiling on uploadable extensions | Letting a Super Admin control what individual sites may upload | A site-level filter cannot widen a type that the network has excluded |
| Form, security, server, or host rule | An additional layer outside core upload handling | Diagnosing failures after WordPress accepts the type | Each layer has its own configuration and logging |
For a normal site-level change, start with upload_mimes. Use mime_types only when you intentionally need to extend the general map for code that reads it independently of the upload allowlist.
Add one MIME type with upload_mimes
Put a narrow rule in a small custom plugin or another site-specific functionality location. That keeps the change when the active theme changes and makes it possible to audit or remove the rule without editing WordPress core.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems<?php
/**
* Plugin Name: Site upload MIME rules
*/
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['json'] = 'application/json';
return $mimes;
} );
Save the file as a PHP plugin in the site’s wp-content/plugins directory, activate it in the Plugins screen, and replace the example pair with the exact extension and MIME value required by your format. Do not add a wildcard or a rule that accepts every extension.
If the functionality is already managed in a site-specific plugin, add the filter there instead of creating a second plugin. A child theme’s functions.php can also hold the filter, but a theme change then removes the behavior; a functionality plugin is usually easier to audit and deploy.
Allow several documented formats in one rule
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['json'] = 'application/json';
$mimes['csv'] = 'text/csv';
$mimes['svg'] = 'image/svg+xml';
$mimes['webp'] = 'image/webp';
return $mimes;
} );
Keep each entry explicit. If a format has more than one legitimate extension, add each extension deliberately and document why it is needed. Do not assume that a browser’s reported content type is trustworthy; WordPress still needs to inspect the file during the upload process.
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.
Inspect the active map before changing code
A frequent cause of confusion is testing against a map that is different from the one used by the upload request. You can inspect the effective allowlist from a temporary administrative diagnostic, a controlled debugging endpoint, or a command-line bootstrap that loads WordPress:
$allowed = get_allowed_mime_types();
error_log( print_r( $allowed, true ) );
Search the resulting array for the extension you need. The keys may contain several extensions separated by a pipe character, so look for the exact entry rather than assuming one key equals one suffix. Remove diagnostic output after testing; exposing the complete list to unauthenticated visitors is unnecessary.
To check a filename against a supplied map:
$result = wp_check_filetype( 'sample.json', get_allowed_mime_types() );
// $result['ext'] is 'json' and $result['type'] is 'application/json'
// when the current map permits that pair.
A false ext or type means that the filename did not match the map passed to the function. It does not prove that the file is corrupt; it indicates that the current allowlist or extension is wrong.
Fix “Sorry, this file type is not permitted for security reasons”
Work through the checks in order. Changing several layers at once makes it difficult to identify the real restriction.
1. Confirm the pair you intend to allow
- Write down the exact extension, without the leading dot, and the MIME string required by the format.
- Check that the filename has only the expected final extension. A name such as
report.json.exemust not be treated as JSON. - Confirm that your filter is loaded on the request that performs the upload. A plugin that is inactive, placed in the wrong directory, or guarded by an admin-only condition will not change the allowlist.
2. Check the effective allowlist
Use get_allowed_mime_types() in a controlled diagnostic and verify that the extension appears with the intended MIME value. If it is absent, correct the filter before investigating the file itself.
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.
3. Check Multisite network restrictions
On Multisite, WordPress applies the network’s permitted extension list as an additional limit. A Super Admin should open Network Admin → Settings → Upload file types and add the extension there if network policy allows it. Core’s check_upload_mimes() intersects the general map with the network upload_filetypes option. The documented default for that option is jpg jpeg png gif; a site-level filter cannot expand a network list that omits the requested type.
4. Check the bytes and image metadata
If the extension appears in the map but the upload is rejected, compare the file’s real contents with its name. WordPress’s wp_check_filetype_and_ext() performs the normal mapping and, for images, attempts to determine the actual MIME type. It can reject an extension/content mismatch or return a corrected filename for an image.
if ( ! function_exists( 'wp_check_filetype_and_ext' ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
$check = wp_check_filetype_and_ext(
$path_to_uploaded_file,
$original_filename,
get_allowed_mime_types()
);
if ( empty( $check['ext'] ) || empty( $check['type'] ) ) {
// Reject the upload and record a useful, private diagnostic.
}
The include is important when this function is called from a plugin or theme and the function has not already been loaded.
5. Look beyond WordPress core
A form builder may maintain its own extension list. A security plugin, web server, reverse proxy, or hosting policy may also block a type after WordPress has accepted it. Compare the browser’s error with the PHP error log and the server response, and review those products’ allowlists one at a time. Do not weaken WordPress validation merely to bypass an unrelated layer.
Free tools Windows power users keep installed
One-click scans. No signup required.
Validate custom uploads securely
The media-library path is not the only place files enter a site. A custom form or REST endpoint must perform its own checks before moving a temporary file into permanent storage.
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
- Sanitize the name first. Apply WordPress filename sanitization before examining the extension. This removes unsafe characters and reduces ambiguity in names supplied by a user.
- Use an allowlist. Accept only the exact extensions and MIME values required by the feature. An “allow everything” policy turns a convenience fix into an execution and content-delivery risk.
- Check both name and content. Use
wp_check_filetype()for the extension-to-MIME decision and preferwp_check_filetype_and_ext()when image content needs verification. - Keep storage and permissions appropriate. A file that contains markup or script-like content needs additional sanitization and access controls; merely labeling it with an image MIME type is not a sanitizer.
- Log rejections without exposing internals. Record the extension, detected type, and reason in a private log, but return a generic message to an unauthenticated uploader.
Do not enable ALLOW_UNFILTERED_UPLOADS for a routine fix. That constant bypasses the narrow allowlist model and should not be a substitute for identifying the one format the feature actually needs.
Common recipes and their cautions
JSON
For configuration or data files, the usual pair is json and application/json. Keep access controls in mind: JSON can disclose application data even though it is not normally executable.
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['json'] = 'application/json';
return $mimes;
} );
CSV
Comma-separated files commonly use csv and text/csv. If the file will later be opened in a spreadsheet, treat imported cell content as untrusted data and validate it in the importing feature; allowing the upload does not validate rows or formulas.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['csv'] = 'text/csv';
return $mimes;
} );
WebP
WebP images use webp and image/webp. Confirm that the installed WordPress and image-processing stack can generate the sizes your site needs after the file is accepted. If the file is renamed from another format, content validation still has to pass.
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['webp'] = 'image/webp';
return $mimes;
} );
SVG and SVGZ
SVG is XML and can contain active or externally referenced content; SVGZ is its compressed form. If you decide to permit either, add only the required extension and put sanitization, who-can-upload rules, and serving controls in place. A MIME filter alone does not make an SVG safe.
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.
add_filter( 'upload_mimes', function ( $mimes ) {
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';
return $mimes;
} );
When to use mime_types instead
WordPress describes mime_types as a filter for adding entries to the general MIME map. Its documented guidance is: “This filter should be used to add, not remove, mime types. To remove mime types, use the ‘upload_mimes’ filter.” That makes it useful when another part of your code calls wp_get_mime_types() and needs to see a new mapping, but it is not the usual control for restricting uploads.
add_filter( 'mime_types', function ( $mimes ) {
$mimes['json'] = 'application/json';
return $mimes;
} );
Adding the same pair to both filters is usually unnecessary. Start with the upload filter, then add the general-map filter only when a specific integration demonstrably requires it.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Compare the ways to manage a MIME rule
| Approach | Scope | Map or allowlist | Content validation | Who can upload | Removal and audit |
|---|---|---|---|---|---|
Site-specific plugin using upload_mimes |
One site | Changes the upload allowlist | Use WordPress validation functions separately | Any role already permitted to upload, subject to WordPress capabilities | Deactivate or delete one documented rule |
| Theme or child-theme code | One site while that theme is active | Changes the upload allowlist | Use WordPress validation functions separately | Existing upload-capable users | Can disappear during a theme change; harder to audit as site functionality |
| Network setting on Multisite | All sites in the network | Caps the extensions available to sites | Core still performs its normal checks | Controlled by each site’s capabilities after the network permits the type | Changed by a Super Admin in Network Admin |
| Generic MIME-management plugin | Depends on its configuration; may be site or network wide | May alter the map, the upload allowlist, or both | Verify whether it checks file contents; do not assume it does | Depends on plugin and WordPress capabilities | Review settings, exported configuration, and plugin deactivation behavior |
| Hosting or web-server rule | Server, virtual host, or account | Usually an additional restriction | Often outside WordPress’s validation functions | All requests reaching that layer | Requires server-level documentation and change control |
Test the change without weakening security
- Back up the plugin or site-specific code and note the original allowlist.
- Activate the narrow filter and reload the upload screen.
- Upload a genuine sample of the intended format, not a file that was merely renamed.
- Confirm that WordPress stores the file, records the expected extension and MIME value, and generates any required metadata.
- Try a deliberately mismatched sample in a controlled environment and confirm that validation rejects it.
- Repeat the test as the roles that should and should not have access, especially on Multisite.
- Review PHP and web-server logs, then remove temporary diagnostics and test files.
For a production rollout, record the extension, MIME value, business reason, approving administrator, date, and removal plan. That small audit trail prevents an old exception from becoming a permanent, forgotten attack surface.
Remove or roll back a MIME change
Delete the specific array entry from the plugin, or deactivate the plugin that owns it, then clear any object or page cache that could leave an old upload form visible. If the type was also added to a Multisite network’s upload list, a Super Admin must remove it there separately. Existing files are not automatically deleted when a MIME rule is removed; decide how those files should be retained, quarantined, or served before changing the policy.
The safest long-term configuration is therefore small and explicit: one documented filter, one required extension/MIME pair, normal WordPress content checks, and a network-level review when Multisite is involved.
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.
Recommended Free Tools




