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