Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: max_srcset_image_width

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1044
1045      /**
1046       * Filter the maximum image width to be included in a 'srcset' attribute.
1047       *
1048       * @since 4.4.0
1049       *
1050       * @param int   $max_width  The maximum image width to be included in the 'srcset'. Default '1600'.
1051       * @param array $size_array Array of width and height values in pixels (in that order).
1052       */
1053      $max_srcset_image_width = apply_filters( 'max_srcset_image_width', 1600, $size_array );
1054
1055      // Array to hold URL candidates.
1056      $sources = array();
1057
1058      /**
1059       * To make sure the ID matches our image src, we will check to see if any sizes in our attachment
1060       * meta match our $image_src. If no matches are found we don't return a srcset to avoid serving
1061       * an incorrect image. See #35045.
1062       */