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.
| Line | Code |
|---|---|
| 1172 | * @since 2.8.0 |
| 1173 | * @since 6.8.2 The `$attr` array includes `width` and `height` attributes. |
| 1174 | * |
| 1175 | * @param string[] $attr Array of attribute values for the image markup, keyed by attribute name. |
| 1176 | * See wp_get_attachment_image(). |
| 1177 | * @param WP_Post $attachment Image attachment post. |
| 1178 | * @param string|int[] $size Requested image size. Can be any registered image size name, or |
| 1179 | * an array of width and height values in pixels (in that order). |
| 1180 | */ |
| 1181 | $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size ); |
| 1182 | |
| 1183 | if ( isset( $attr['width'] ) && is_numeric( $attr['width'] ) ) { |
| 1184 | $width = absint( $attr['width'] ); |
| 1185 | } |
| 1186 | if ( isset( $attr['height'] ) && is_numeric( $attr['height'] ) ) { |
| 1187 | $height = absint( $attr['height'] ); |
| 1188 | } |
| 1189 | unset( $attr['width'], $attr['height'] ); |
| 1190 | |