• StackOverflow has a “solution” of code to add to wp-includes/functions.php, and the solution has 7 points, but it doesn’t say where in the functions.php file to insert the code, and when I inserted it, my site broke.
    Also, note that the suggested code doesn’t include a closing “>” — intentional?
    You need 50 reputation to comment, so I can’t comment there.

    The answer says:
    You need to add the file extension to the accepted array.

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

    source:
    https://stackoverflow.com/questions/65532649/how-can-we-get-wordpress-to-support-jfif-image-upload

    • This topic was modified 2 years, 3 months ago by Jan Dembowski.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Jonathon N

    (@imagiscapeca)

    After making that change to functions.php, will the next wordpress update replace my functions.php file?

    Why doesn’t WordPress just add the jfif file type for everyone?

    Thread Starter Jonathon N

    (@imagiscapeca)

    This plugin exists – https://www.ads-software.com/plugins/file-upload-types/ – but:

    (1) it hasn’t been updated in over a year,

    (2) people laugh when they hear how many plugins i have. (way too many, they mock)

    Moderator bcworkz

    (@bcworkz)

    How you add the suggested code depends on the surrounding context of where you want to place it. Typically in functions.php, you needn’t add any sort of <?php ?> delimiters. They already exist where needed. Adding one where it is not needed can cause errors. Likely dropping the <?php from your snippet will resolve the error. YMMV. The snippet can go at the very end of the file.

    PHP does not require a closing ?> at the end of a file if no further HTML content is involved. It’s actually preferred to not use it because it can prevent difficult to find errors in code due to white space being were it does not belong.

    A WP core update will not wipe out functions.php alterations, but a theme update will. The simplest way to add code that’s safe from updates is to create your own custom plugin. Yes, yet another plugin. But this one would be very simple and minimal and specifically meets your need and nothing else.

    While it’s true that a lot of plugins can cause issues, if every plugin meets a real need and your site continues to adequately function, then ignore the naysayers ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding JFIF Mime type to functions.php’ is closed to new replies.