<?php
// Set max width
function filter_max_srcset( $max_width, $size_array ) {
$original_width = $size_array [ 0 ];
$original_height = $size_array [ 1 ];
$max_width = 768;
return $max_width;
}
add_filter( 'max_srcset_image_width', 'filter_max_srcset', 10, 2 );
// Remove max width (1600px) restriction
function remove_max_srcset_image_width( $max_width ) {
return false;
}
add_filter( 'max_srcset_image_width', 'remove_max_srcset_image_width' );
>= WP 4.4 - Use to reduce srcset sizes in responsive images. https://developer.wordpress.org/reference/hooks/max_srcset_image_width/ used by https://developer.wordpress.org/reference/functions/wp_calculate_image_srcset/
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.