How to Get WordPress to Support Jfif File Type Extension

We are influencers and brand affiliates.  This post contains affiliate links, most which go to Amazon and are Geo-Affiliate links to nearest Amazon store.

So WordPress natively at the time of this writing does not support jfif as a file extension type you can upload in the media library, when you try to upload a jfif file in the add media section you will get a WordPress Sorry, this file type is not permitted for security reasons error.  A jpg is really a Jfif so realistically this is just about having WordPress not block this file type by default and you can implement this theme edit to your functions.php to allow this file type to work and be added.  Note though, that every time you do a Theme update this change could be undone and you would have to implement this feature fix again.

With discord, Amazon and more images being defaulted to .jfif format it makes sense to just modify WordPress to allow the JFIF format so you don’t have to edit your images in Paint Dot Net or perform any jfif to jpeg file conversions first just so you can upload that jfif image file to WordPress.  Here are steps you can use to modify your WordPress theme to support jfif file uploads.

Step 1 – Go to Appearance > Theme Editor from your Dashboard or “File Manager” in your Web Hosting Provider Dashboard/Panel

So you can either edit the functions.php file directly inside your WordPress dashboard with the Theme Editor under Appearance

Or you can go into your File Manager at your web hosting provider (usually in your CPanel or other Panel area) and browse to your sites wp-content/themes/[theme name]/ folder.

In the example image above this is what it looks like in my WPX Hosting file manager, where I am currently using the Avada WordPress Theme.   You should take a backup and copy your functions.php file before making any changes as a mistake can break your site and theme, so you need a clean functions.php file in case you have to restore and recover from a mistake.  Note, if you break your functions.php while editing from the WordPress dashboard you will end up using the file manager at your web host provider anyway, so my recommendation is to only use the file manager option at your web hosting.

Step 2 – Edit the Functions.PHP File and Add Code Block

You edit the functions.php file and want to add this section.  Make sure this section occurs below the initial <php> tag and is not inserted inside another block of code by mistake.

/* Add JFIF image file type for uploads */

add_filter( ‘upload_mimes’, ‘custom_myme_types’, 1, 1 );
function custom_myme_types( $mime_types ) {
$mime_types[‘jfif’] = ‘image/jfif+xml’; // Adding .jfif extension

return $mime_types;
}

The first line above is just a comment line to tell you what the function is doing.  The function here is adding a sub filter to upload_mimes so that the additional jfif mime type can be included.    You can similarly add this same line for additional file types, for purposes of this article we are only adding jfif files to be allowed by the WordPress add media button.

After entering the text, it should look like the below image.

Step 3 – Test Uploading a Jfif File to WordPress

After saving the file you should immediately have access to upload jfif file type to WordPress and you can test this by going to add media and choosing a jfif file type from your desktop.

My below image shows that I have uploaded, but you will notice something funny.  WordPress will autoamatically rename the file from .jfif to .jpg extension as part of the upload, so it detects that a jfif is a jpeg and just simply converts it to .jpg automatically just by uploading the jfif file.

 

Hopefully this save you some time and allows you to quickly upload your jfif files to WordPress without having to convert the jfif files to jpg before uploading them to WordPress.

We are influencers and brand affiliates.  This post contains affiliate links, most which go to Amazon and are Geo-Affiliate links to nearest Amazon store.

assetto corsa mods