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