Use Smush only for JPGs

Would it be possible to optimize only JPGS, not PNGs? It's very important, because the PNGs need to have perfect quality and we have 4000 Pictures.

  • Nithin
    • Support Wizard

    Hi Tom,

    Hope you are doing good today. :slight_smile:

    I'm afraid, there isn't any out of the box setting in the plugin side to do this, however you could try this code, and see whether it helps in your use case.

    add_filter('wp_smush_image', 'wpmudev_no_smush_img', 10, 2);
    function wpmudev_no_smush_img($smush, $ID) {
        if(!$ID) return false;
        $type = get_post_mime_type($ID);
        switch($type) {
            case 'image/png':
                return false;
        return true;

    The above code will make sure smush skips PNG images from Smushing. Please test, and see how that goes, and let us know if you have any further query.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.