wp_get_attachment_image_context
Filters the context in which wp_get_attachment_image() is used.
Usage
add_filter( 'wp_get_attachment_image_context', 'wp_kama_get_attachment_image_context_filter' );
/**
* Function for `wp_get_attachment_image_context` filter-hook.
*
* @param string $context The context.
*
* @return string
*/
function wp_kama_get_attachment_image_context_filter( $context ){
// filter...
return $context;
}
- $context(string)
- The context.
Default: 'wp_get_attachment_image'
Changelog
| Since 6.3.0 | Introduced. |
Where the hook is called
wp_get_attachment_image_context
wp-includes/media.php 1095
$context = apply_filters( 'wp_get_attachment_image_context', 'wp_get_attachment_image' );
Where the hook is used in WordPress
wp-includes/media.php 2480
add_filter( 'wp_get_attachment_image_context', '_wp_post_thumbnail_context_filter' );
wp-includes/media.php 2492
remove_filter( 'wp_get_attachment_image_context', '_wp_post_thumbnail_context_filter' );
wp-includes/shortcodes.php 267
$filter_added = add_filter( 'wp_get_attachment_image_context', '_filter_do_shortcode_context' );
wp-includes/shortcodes.php 280
remove_filter( 'wp_get_attachment_image_context', '_filter_do_shortcode_context' );