wp_get_attachment_image_context
Filter HookDescription
Filters the context in which wp_get_attachment_image() is used.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1092 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$context
|
The context. Default 'wp_get_attachment_image'. |
Usage Examples
Basic Usage
<?php
// Hook into wp_get_attachment_image_context
add_filter('wp_get_attachment_image_context', 'my_custom_filter', 10, 1);
function my_custom_filter($context) {
// Your custom filtering logic here
return $context;
}
Source Code Context
wp-includes/media.php:1092
- How this hook is used in WordPress core
<?php
1087 *
1088 * @since 6.3.0
1089 *
1090 * @param string $context The context. Default 'wp_get_attachment_image'.
1091 */
1092 $context = apply_filters( 'wp_get_attachment_image_context', 'wp_get_attachment_image' );
1093 $attr = wp_parse_args( $attr, $default_attr );
1094 $attr['width'] = $width;
1095 $attr['height'] = $height;
1096
1097 $loading_optimization_attr = wp_get_loading_optimization_attributes(
PHP Documentation
<?php
/**
* Filters the context in which wp_get_attachment_image() is used.
*
* @since 6.3.0
*
* @param string $context The context. Default 'wp_get_attachment_image'.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.