WordPress natively on the time of this writing doesn’t support jfif as a file extension kind you can add within the media library, once you attempt to add a jfif file within the add media you’ll get a WordPress Sorry, this file type is not permitted for security reasons error.  A jpg is actually a Jfif so realistically that is just about having WordPress not block this file type by default and you can implement this theme edit to your functions.php to permit this file type to work and be added.  Do take notice that each time you do a Theme update this edit may very well be undone and you’d have to implement this function fix once more.

With discord, Amazon and more images being defaulted to .jfif format it makes sense to simply modify WordPress to permit the JFIF format so that you don’t have to edit your pictures in Paint Dot Net or carry out any jfif to jpeg file conversions first, just simply add that jfif picture file to WordPress.  Here are steps you should 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

You can both edit the functions.php file directly inside your WordPress dashboard with the Theme Editor below Appearance

How to upload JFIF files in WordPress?

Or you can go into your hosting File Manager (often in your CPanel or different Panel area) and browse to your files wp-content/themes/[theme name]/ folder.

 

How to upload JFIF files in WordPress?

In the example picture above this is what it looks like in my WPX Hosting file manager. You should always take a backup and copy your functions.php file before making any edit as a mistake can break your web site and theme so that you want a clean functions.php file in case you have to restore and recover from a mistake.  Note, if you happen to break your functions.php while editing from the WordPress dashboard you’ll find yourself using the file manager at your host provider anyway, so my suggestion is to only use the file manager option first place.

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

Edit the functions.php file and add this section.  Make sure this section is inserted below the initial <php> tag and isn’t inserted inside another block of code rule 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 only a comment line to let you know what the function is doing.  The function here is adding a sub-filter to upload_mimes so that the extra jfif mime file type will be included.    You can equally add this same line for additional file types, for purposes of this article we’re only including jfif files to be allowed by the WordPress add media button.

After entering the text, it should look like the beneath picture.

 

How to upload JFIF files in WordPress?

Step 3 – Test Uploading a Jfif File to WordPress

After saving the file it is best to check it right away. Try to upload a jfif file to your WordPress media library. You might want to hard refresh your browser to your edit takes effect. 

How to upload JFIF files in WordPress?

My below picture shows that I’ve uploaded, however, you’ll discover one thing funny.  WordPress will automatically rename the file from .jfif to .jpg extension as a 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 add your jfif files to WordPress with out having to convert the jfif files to jpg before uploading them to WordPress.

Sending
User Review
0 (0 votes)