Diagnose a File Type Mismatch in WordPress Media Uploads
An image renamed from PNG to JPG remains a PNG until an image application converts it. Compare a known-good upload with a controlled mismatch on staging to determine where WordPress rejects the file.
Prepare a small fixture pair
Export a new JPEG and PNG from an image editor. Use non-sensitive images and names. Keep one valid JPEG, then make a separate copy of the PNG with a JPG extension. Record the true format reported by the editor or a local file inspection tool. Do not add PHP or other executable content.
Inspect the permitted types and exact error
Upload the valid JPEG through the ordinary Media Library as the affected role. Then use the mismatched fixture. Record the error and whether the fixture created an attachment. WordPress wp_check_filetype_and_ext checks the filename and attempts to determine the real type. Image checks can produce a corrected filename in applicable cases. An installed plugin or a host upload policy can add further checks.
Correct the source file
Export into the approved format and use the extension that matches the new bytes. If the valid file still fails, compare role, Multisite policy and any upload filters, using sanitized logs from the failing staging request. Keep existing file-type controls in place while troubleshooting.
Expected result
A freshly exported allowed file uploads and generates the expected media preview. Record whether the issue was a format mismatch, network policy or another stage of processing.
Related guides
- How to Diagnose WordPress Media Upload Errors
- How to Preserve WordPress Images and Uploads During Migration
Official references
Ferkesh Hosting. Last reviewed .
Zpětná vazba byla odeslána!