WordPress filter hook · part of WordPress core
max_srcset_image_width
A WordPress core filter that 8 plugins also fire themselves, running on 5,190+ sites between them.
“This filter is documented in wp-includes/media.php”
How to use max_srcset_image_width
It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'max_srcset_image_width', function( $value, $size_array ) {
// Change $value here.
return $value;
}, 10, 2 );Argument names come from GoDAM's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
8 plugins that fire max_srcset_image_width
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WP EasyCart: Shopping Cart and eCommerce Store3,000+ installs
apply_filters( 'max_srcset_image_width', 2048, array( $copy['width'], $copy['height'] ) )inc/classes/core/class-wp-easycart-product-photos.php:775 -
RICG Responsive Images2,000+ installs
apply_filters( 'max_srcset_image_width', 1600, $size_array )wp-tevko-core-functions.php:155 -
GoDAM100+ installs
apply_filters( 'max_srcset_image_width', 2048, $size_array )inc/classes/class-media-library-ajax.php:1643 -
Imageshop DAM Connector70+ installs
apply_filters( 'max_srcset_image_width', 2048, $display_size )includes/Media/Attachment.php:639 -
THRON10+ installs
apply_filters( 'max_srcset_image_width', 2048, $size_array )public/class-thron-public.php:321 -
Responsive Images10+ installs
apply_filters( 'max_srcset_image_width', 1920, $size_array )ChangeResponsiveImages.class.php:137 -
SOptimizerFewer than 10 installs
apply_filters( 'max_srcset_image_width', 1600, array( $full_w, 0 ) )includes/class-siskopfowo-responsive-images.php:662 -
Empirical Responsive ImagesFewer than 10 installs
apply_filters( 'max_srcset_image_width', 2048, array( $source_width, absint( $target['source_height'] ?? 0 ), ) )includes/class-visitor-gap-target.php:427
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.