Make WordPress Core

Opened 22 months ago

Last modified 13 months ago

#49086 new defect (bug)

The "site_icon" option isn't always removed when the site icon is deleted

Reported by: henry.wright Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords: dev-feedback has-patch
Focuses: Cc:


If you delete the site icon image by going to Media > Library, the "site_icon" option isn't deleted from the database. Note the option is deleted if you go Appearance > Customize and remove the icon through the Site Identity tab.

Attachments (1)

49086.diff (641 bytes) - added by henry.wright 22 months ago.

Download all attachments as: .zip

Change History (4)

#1 @henry.wright
22 months ago

  • Keywords dev-feedback added

I should clarify.

When the site icon is removed by Appearance > Customize, the value of site_icon in the options table is either set to 0 or the option is deleted.

When the site icon image file is deleted by Media > Library, the value of site_icon in the options table remains something like 55.

This causes problems because the result of get_option( 'site_option' ) is used to determine if a site icon exists in functions like get_site_icon_url().

$site_icon_id = get_option( 'site_icon' );
if ( $site_icon_id ) {
    // This does not guarantee the site icon exists because of the bug above
Last edited 22 months ago by henry.wright (previous) (diff)

22 months ago

#2 @henry.wright
22 months ago

  • Keywords has-patch added

49086.diff deletes the site_icon option if the media file used for the site icon is deleted.

#3 @sabernhardt
13 months ago

  • Component changed from General to Media
Note: See TracTickets for help on using tickets.