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:

functions.php
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.

  1. WP EasyCart: Shopping Cart and eCommerce Store icon 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
  2. RICG Responsive Images icon RICG Responsive Images2,000+ installs apply_filters( 'max_srcset_image_width', 1600, $size_array ) wp-tevko-core-functions.php:155
  3. GoDAM icon GoDAM100+ installs apply_filters( 'max_srcset_image_width', 2048, $size_array ) inc/classes/class-media-library-ajax.php:1643
  4. Imageshop DAM Connector icon Imageshop DAM Connector70+ installs apply_filters( 'max_srcset_image_width', 2048, $display_size ) includes/Media/Attachment.php:639
  5. THRON icon THRON10+ installs apply_filters( 'max_srcset_image_width', 2048, $size_array ) public/class-thron-public.php:321
  6. Responsive Images icon Responsive Images10+ installs apply_filters( 'max_srcset_image_width', 1920, $size_array ) ChangeResponsiveImages.class.php:137
  7. SOptimizer icon SOptimizerFewer than 10 installs apply_filters( 'max_srcset_image_width', 1600, array( $full_w, 0 ) ) includes/class-siskopfowo-responsive-images.php:662
  8. Empirical Responsive Images icon 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.