Filter hook 'image_get_intermediate_size'

in WP Core File wp-includes/media.php at line 870

View Source

image_get_intermediate_size

Filter Hook
Description
Filters the output of image_get_intermediate_size()

Hook Information

File Location wp-includes/media.php View on GitHub
Hook Type Filter
Line Number 870

Hook Parameters

Type Name Description
array $data Array of file relative path, width, and height on success. May also include file absolute path and URL.
int $post_id The ID of the image attachment.
string|int[] $size Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).

Usage Examples

Basic Usage
<?php
// Hook into image_get_intermediate_size
add_filter('image_get_intermediate_size', 'my_custom_filter', 10, 3);

function my_custom_filter($data, $post_id, $size) {
    // Your custom filtering logic here
    return $data;
}

Source Code Context

wp-includes/media.php:870 - How this hook is used in WordPress core
<?php
 865  	 *                              file absolute path and URL.
 866  	 * @param int          $post_id The ID of the image attachment.
 867  	 * @param string|int[] $size    Requested image size. Can be any registered image size name, or
 868  	 *                              an array of width and height values in pixels (in that order).
 869  	 */
 870  	return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size );
 871  }
 872  
 873  /**
 874   * Gets the available intermediate image size names.
 875   *

PHP Documentation

<?php
/**
	 * Filters the output of image_get_intermediate_size()
	 *
	 * @since 4.4.0
	 *
	 * @see image_get_intermediate_size()
	 *
	 * @param array        $data    Array of file relative path, width, and height on success. May also include
	 *                              file absolute path and URL.
	 * @param int          $post_id The ID of the image attachment.
	 * @param string|int[] $size    Requested image size. Can be any registered image size name, or
	 *                              an array of width and height values in pixels (in that order).
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/media.php
Related Hooks

Related hooks will be displayed here in future updates.