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