Adding JFIF file support to WordPress

The issue

A while ago I noticed that WordPress does not support JFIF out of the box. Sometimes I download JFIF files from other sites to use them inside WordPress but till now it did not work.

The solution I don’t like

Some people described to add support for this format to alter the theme file or even wpconfig.php, I don’t like both of these solutions.

The solution I like

I like to be able to see modifications that I did for my sites in an easy way, so a long time ago I decided to use the Code Snippets plugin for that.

I has a 5 star review and is updated on a regular basis.

CodeSnippets overview in Dutch, sorry!

As you can see it is possible to create all kind of snippets to tweak WordPress, I love that! All by avoiding theme tweaks.

Let me show you how I added support for JFIF file types.

You need to add a new snippet and paste below code:

add_filter('mime_types', 'dd_add_jfif_files');
function dd_add_jfif_files($mimes){
    $mimes['jfif'] = "image/jpeg";
    return $mimes;
}

Just enable it to use it globally and you are fine!

What can you do more?

There is much more you can do with it. Below some ideas:

  • hide the currency symbol in WooCommerce (increase conversion);
  • show extra discounts;
  • manipulate other stuff.

There are endless possibilities!

Related Post

Leave a Reply