Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_get_attachment_image_context

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1086           );
1087
1088           /**
1089            * Filters the context in which wp_get_attachment_image() is used.
1090            *
1091            * @since 6.3.0
1092            *
1093            * @param string $context The context. Default 'wp_get_attachment_image'.
1094            */
1095           $context = apply_filters( 'wp_get_attachment_image_context', 'wp_get_attachment_image' );
1096
1097           $attr = wp_parse_args( $attr, $default_attr );
1098
1099           // Ensure that the `$width` doesn't overwrite an already valid user-provided width.
1100           if ( ! isset( $attr['width'] ) || ! is_numeric( $attr['width'] ) ) {
1101                $attr['width'] = $width;
1102           }
1103
1104           // Ensure that the `$height` doesn't overwrite an already valid user-provided height.