Modern Image Formats icon
Media, Galleries & Sliders

Modern Image Formats hooks reference

  • By WordPress Performance Team
  • v2.7.1
  • Updated

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.

functions.phpyour child theme
// 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

  • hooks.php line 682 · used in 2 places
    /**
     * 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 );
  • image-edit.php line 531
    /**
     * This filter is documented in wp-admin/includes/image-edit.php
     */
    apply_filters( 'image_edit_thumbnails_separately', false );
  • helper.php line 277
    /**
     * 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 );
  • helper.php line 335
    /**
     * Filter whether WebP images that are larger than the matching JPEG should be
     * discarded.
     */
    apply_filters( 'webp_uploads_discard_larger_generated_images', true );
  • hooks.php line 626
    /**
     * 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 );
  • hooks.php line 770
    /**
     * Filters whether additional mime types are allowed for image sizes.
     */
    apply_filters( 'webp_uploads_image_sizes_with_additional_mime_type_support', $allowed_sizes );
  • helper.php line 607
    /**
     * Filters whether Imagick has AVIF transparency support.
     */
    apply_filters( 'webp_uploads_imagick_avif_transparency_supported', $supported );
  • picture-element.php line 133
    /**
     * 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 );
  • helper.php line 118
    /**
     * 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 );
  • helper.php line 61
    /**
     * 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: