apply_filters( 'fallback_intermediate_image_sizes', string[] $fallback_sizes, array $metadata )
- Since
- 4.7.0
Filters the image sizes generated for non-image mime types.
Compatibility
- WordPress
- since 4.7.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$fallback_sizesstring[]- An array of image size names.
$metadataarray- Current attachment metadata.
Where this hook fires · 2
wp-admin/includes/image.php:686wp_generate_attachment_metadata()wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php:1540WP_REST_Attachments_Controller::prepare_item_for_response()
Source code
* * @since 4.7.0 * * @param string[] $fallback_sizes An array of image size names. * @param array $metadata Current attachment metadata. */ $fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata ); $registered_sizes = wp_get_registered_image_subsizes(); $merged_sizes = array_intersect_key( $registered_sizes, array_flip( $fallback_sizes ) ); // Force thumbnails to be soft crops. if ( isset( $merged_sizes['thumbnail'] ) && is_array( $merged_sizes['thumbnail'] ) ) {Changelog
Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.