WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
Line | Code |
---|---|
199 | * down-sizing the image, returning that value instead. |
200 | * |
201 | * @since 2.5.0 |
202 | * |
203 | * @param bool|array $downsize Whether to short-circuit the image downsize. |
204 | * @param int $id Attachment ID for image. |
205 | * @param array|string $size Requested size of image. Image size name, or array of width |
206 | * and height values (in that order). |
207 | */ |
208 | $out = apply_filters( 'image_downsize', false, $id, $size ); |
209 |
|
210 | if ( $out ) { |
211 | return $out; |
212 | } |
213 |
|
214 | $img_url = wp_get_attachment_url( $id ); |
215 | $meta = wp_get_attachment_metadata( $id ); |
216 | $width = 0; |
217 | $height = 0; |
Line | Code |
3540 | /* |
3541 | * Loop through all potential sizes that may be chosen. Try to do this with some efficiency. |
3542 | * First: run the image_downsize filter. If it returns something, we can use its data. |
3543 | * If the filter does not return something, then image_downsize() is just an expensive way |
3544 | * to check the image metadata, which we do second. |
3545 | */ |
3546 | foreach ( $possible_sizes as $size => $label ) { |
3547 |
|
3548 | /** This filter is documented in wp-includes/media.php */ |
3549 | $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ); |
3550 |
|
3551 | if ( $downsize ) { |
3552 | if ( empty( $downsize[3] ) ) { |
3553 | continue; |
3554 | } |
3555 |
|
3556 | $sizes[ $size ] = array( |
3557 | 'height' => $downsize[2], |
3558 | 'width' => $downsize[1], |