wp_img_tag_add_srcset_and_sizes_attr

wp_img_tag_add_srcset_and_sizes_attr

Hook Type: filter

See hook in core

Displaying hooks found in version: wordpress-6.4.3

apply_filters('wp_img_tag_add_srcset_and_sizes_attr') is found 1 times:

  • /wp-includes/media.php line 2151
    	 * @param string $image         The HTML `img` tag where the attribute should be added.
    	 * @param string $context       Additional context about how the function was called or where the img tag is.
    	 * @param int    $attachment_id The image attachment ID.
    	 */
    	$add = apply_filters( 'wp_img_tag_add_srcset_and_sizes_attr', true, $image, $context, $attachment_id );
    
    	if ( true === $add ) {
    		$image_meta = wp_get_attachment_metadata( $attachment_id );
    		return wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id );
    	}