Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: site_icon_image_sizes

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

This hook occurs 2 times in this file.

Line Code
143           $only_crop_sizes = array();
144
145           /**
146            * Filters the different dimensions that a site icon is saved in.
147            *
148            * @since 4.3.0
149            *
150            * @param int[] $site_icon_sizes Array of sizes available for the Site Icon.
151            */
152           $this->site_icon_sizes = apply_filters( 'site_icon_image_sizes', $this->site_icon_sizes );
153
154           // Use a natural sort of numbers.
155           natsort( $this->site_icon_sizes );
156           $this->site_icon_sizes = array_reverse( $this->site_icon_sizes );
157
158           // Ensure that we only resize the image into sizes that allow cropping.
159           foreach ( $sizes as $name => $size_array ) {
160                if ( isset( $size_array['crop'] ) ) {
161                     $only_crop_sizes[ $name ] = $size_array;
 
Line Code
179       * Adds Site Icon sizes to the array of image sizes on demand.
180       *
181       * @since 4.3.0
182       *
183       * @param string[] $sizes Array of image size names.
184       * @return string[] Array of image size names.
185       */
186      public function intermediate_image_sizes( $sizes = array() ) {
187           /** This filter is documented in wp-admin/includes/class-wp-site-icon.php */
188           $this->site_icon_sizes = apply_filters( 'site_icon_image_sizes', $this->site_icon_sizes );
189           foreach ( $this->site_icon_sizes as $size ) {
190                $sizes[] = 'site_icon-' . $size;
191           }
192
193           return $sizes;
194      }
195
196      /**
197       * Deletes the Site Icon when the image file is deleted.