max_srcset_image_width

Filters the maximum image width to be included in a 'srcset' attribute.

Description

apply_filters( 'max_srcset_image_width', (int) $int, (array) $size_array ); 

Parameters (2)

0. $int (int) => 1600
The maximum image width to be included in the srcset.. Default 1600.
1. $size_array (array)
Array of width and height values in pixels (in that order).

Usage

To run the hook, copy the example below.
  1. $int = apply_filters( 'max_srcset_image_width', $int, $size_array ); 
  2.  
  3. if ( !empty( $int ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the max_srcset_image_width callback 
  2. function filter_max_srcset_image_width( $int, $size_array ) { 
  3. // make filter magic happen here... 
  4. return $int
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'max_srcset_image_width', 'filter_max_srcset_image_width', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'max_srcset_image_width', 'filter_max_srcset_image_width', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/media.php  
  1. $max_srcset_image_width = apply_filters( 'max_srcset_image_width', 1600, $size_array );