WordPress at a glance
filter is not described

intermediate_image_sizes_advanced filter-hook . WP 2.9.0

Filters the image sizes automatically generated when uploading an image.


add_filter( 'intermediate_image_sizes_advanced', 'filter_function_name_6123', 10, 3 );
function filter_function_name_6123( $sizes, $metadata, $attachment_id ){
	// filter...

	return $sizes;
An associative array of image sizes.
An associative array of image metadata: width, height, file.
Current attachment ID.


Since 2.9.0 Introduced.
Since 4.4.0 Added the $metadata argument.
Since 5.1.0 Added the $attachment_id argument.

Where the hook is called

wp-admin/includes/image.php 139
$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes, $metadata, $attachment_id );

Where the hook is used (in WP core)

wp-admin/includes/ajax-actions.php 3644
add_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) );
wp-admin/includes/ajax-actions.php 3646
remove_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) );