Modern Image Formats 2.7.1 has 0 actions and 10 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Change a value Modern Image Formats is about to use
add_filter( 'webp_uploads_pre_replace_additional_image_source', function( $image, $attachment_id, $arg3, $target_mime, $context ) {
// Change $image here.
return $image;
}, 10, 5 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
/** * Filter to replace additional image source file, by locating the original * mime types of the file and return correct file path in the end. */ apply_filters( 'webp_uploads_pre_replace_additional_image_source', $image, $attachment_id, 'full', $target_mime, $context ); -
/** * This filter is documented in wp-admin/includes/image-edit.php */ apply_filters( 'image_edit_thumbnails_separately', false ); -
/** * Filters mime types that should be used to update all images in the content. * The order of mime types matters. The first mime type in the list will be * used if it is supported by an image. */ apply_filters( 'webp_uploads_content_image_mimes', $target_mimes, $attachment_id, $context ); -
/** * Filter whether WebP images that are larger than the matching JPEG should be * discarded. */ apply_filters( 'webp_uploads_discard_larger_generated_images', true ); -
/** * Filters whether the Modern Image Formats plugin should rewrite an image * returned by `wp_get_attachment_image()`. */ apply_filters( 'webp_uploads_filter_wp_get_attachment_image', true, $attachment_id, $size, $attr ); -
/** * Filters whether additional mime types are allowed for image sizes. */ apply_filters( 'webp_uploads_image_sizes_with_additional_mime_type_support', $allowed_sizes ); -
/** * Filters whether Imagick has AVIF transparency support. */ apply_filters( 'webp_uploads_imagick_avif_transparency_supported', $supported ); -
/** * Filter the image mime types that can be used for the <picture> element. */ apply_filters( 'webp_uploads_picture_element_mime_types', array( 'image/avif', 'image/webp', ), $attachment_id ); -
/** * Filter to allow the generation of additional image sources, in which a * defined mime type can be transformed and create additional mime types for * the file. */ apply_filters( 'webp_uploads_pre_generate_additional_image_source', null, $attachment_id, $image_size, $size_data, $mime ); -
/** * Filter to allow the definition of a custom mime types, in which a defined * mime type can be transformed and provide a wide range of mime types. */ apply_filters( 'webp_uploads_upload_image_mime_transforms', $default_transforms );
Generated from Modern Image Formats's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Can't find the right hook?
We can build the customisation for you. Describe what you need: