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
1114
1115      /**
1116       * Filters the maximum image width to be included in a 'srcset' attribute.
1117       *
1118       * @since 4.4.0
1119       *
1120       * @param int   $max_width  The maximum image width to be included in the 'srcset'. Default '1600'.
1121       * @param array $size_array Array of width and height values in pixels (in that order).
1122       */
1123      $max_srcset_image_width = apply_filters( 'max_srcset_image_width', 1600, $size_array );
1124
1125      // Array to hold URL candidates.
1126      $sources = array();
1127
1128      /**
1129       * To make sure the ID matches our image src, we will check to see if any sizes in our attachment
1130       * meta match our $image_src. If no matches are found we don't return a srcset to avoid serving
1131       * an incorrect image. See #35045.
1132       */