intermediate_image_sizes_advanced
Filter HookDescription
Filters the image sizes automatically generated when uploading an image.Hook Information
File Location |
wp-admin/includes/image.php
View on GitHub
|
Hook Type | Filter |
Line Number | 410 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$new_sizes
|
Associative array of image sizes to be created. |
array
|
$image_meta
|
The image meta data: width, height, file, sizes, etc. |
int
|
$attachment_id
|
The attachment post ID for the image. |
Usage Examples
Basic Usage
<?php
// Hook into intermediate_image_sizes_advanced
add_filter('intermediate_image_sizes_advanced', 'my_custom_filter', 10, 3);
function my_custom_filter($new_sizes, $image_meta, $attachment_id) {
// Your custom filtering logic here
return $new_sizes;
}
Source Code Context
wp-admin/includes/image.php:410
- How this hook is used in WordPress core
<?php
405 *
406 * @param array $new_sizes Associative array of image sizes to be created.
407 * @param array $image_meta The image meta data: width, height, file, sizes, etc.
408 * @param int $attachment_id The attachment post ID for the image.
409 */
410 $new_sizes = apply_filters( 'intermediate_image_sizes_advanced', $new_sizes, $image_meta, $attachment_id );
411
412 return _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id );
413 }
414
415 /**
PHP Documentation
<?php
/**
* Filters the image sizes automatically generated when uploading an image.
*
* @since 2.9.0
* @since 4.4.0 Added the `$image_meta` argument.
* @since 5.3.0 Added the `$attachment_id` argument.
*
* @param array $new_sizes Associative array of image sizes to be created.
* @param array $image_meta The image meta data: width, height, file, sizes, etc.
* @param int $attachment_id The attachment post ID for the image.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-admin/includes/image.php
Related Hooks
Related hooks will be displayed here in future updates.