WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 5 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: General Keywords: dev-feedback has-patch
Focuses: Cc:

Description

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 5 months ago.

Download all attachments as: .zip

Change History (3)

#1 @henry.wright
5 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 set to 0.

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
}
Version 0, edited 5 months ago by henry.wright (next)

@henry.wright
5 months ago

#2 @henry.wright
5 months ago

  • Keywords has-patch added

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

Note: See TracTickets for help on using tickets.