media regenerate removes/doesn't recreate custom site-icon sizes
Summary
When regenerating all media, the special-case site-icon loses its custom sizes
Steps to Reproduce
- Through Customizer -> Site Identity, add a Site Icon
- Observe that in addition to the originally uploaded image present in the media gallery, a 2nd "cropped" variant is created with unique image sizes
- Run
wp media regenerate --yes - Observe that the cropped variant's sizes are replaced with the standard active sizes
Environment
- PHP 7.1.16 (cli) (built: Mar 31 2018 02:28:54) ( NTS )
- $wp_version = '4.9.6';
- WP-CLI 1.5.1
- twentyseventeen theme, no plugins
Severity - Low
Expected Results: The special case 'site-icon' should be handled as it is in core to generate the correct media sizes
Actual Results: The site-icon image attachment is handled the same as all other uploads, and loses its special sizes, which may cause issues with devices/services looking for/expecting to find images of a particular size. The meta tags output in the site header do link to the newly generated image sizes, but attributes on the meta tags still show the original sizes that were expected to exist.
Core is only expecting this image to ever be set via the customizer, so the case for it is handled in ajax-actions.php which calls on the WP_Site_Icon class from class-wp-site-icon.php.
File and metadata before/after regeneration: https://gist.github.com/dotsam/f31dfed2ee1b64b149883520ee901b43
We should include a hardcoded check for this edge case.