Skip to content

Changes made to the site icon image through media library are not reflected on the site icon. #8831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/wp-admin/includes/image-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,25 @@ function wp_save_image( $post_id ) {
);
}

/**
* Add additional image sizes for the Site Icon during image editing.
*
* If the current attachment is the Site Icon, include the custom site icon sizes
* defined by WP_Site_Icon to ensure proper resizing and metadata generation.
*/
if ( (int) get_option( 'site_icon' ) === (int) $post_id ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-site-icon.php';

$wp_site_icon = new WP_Site_Icon();
$_wp_site_icon_sizes = $wp_site_icon->additional_sizes();

if ( ! empty( $_wp_site_icon_sizes ) ) {
foreach ( $_wp_site_icon_sizes as $size => $size_data ) {
$_sizes[ $size ] = $size_data;
}
}
}

$meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) );
}

Expand Down
Loading