diff --git a/disable-heif.php b/disable-heif.php new file mode 100644 index 0000000..57eca92 --- /dev/null +++ b/disable-heif.php @@ -0,0 +1,36 @@ + + array_filter($m, fn($t) => !preg_match('#^image/(hei[cf]|avif)#i', $t))); + +add_filter('wp_check_filetype_and_ext', function ($data, $file, $filename) { + if (nh_is_heif($file, $filename)) $data['ext'] = $data['type'] = false; + return $data; +}, 10, 3); + +// Keep WordPress away from imagick +add_filter('wp_image_editors', fn() => ['WP_Image_Editor_GD']);