Opened 7 years ago
Last modified 5 years 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: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Media | Version: | |
| Severity: | normal | Keywords: | dev-feedback has-patch |
| Cc: | Focuses: |
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)
Change History (5)
#2
@
7 years ago
- Keywords has-patch added
49086.diff deletes the site_icon option if the media file used for the site icon is deleted.
#4
@
5 years ago
I can confirm this bug. If a site icon is manually deleted from the Media Library, the corresponding site_icon option is never updated or removed.
Although a developer can use has_site_icon() to determine the existence of a site icon, some might use get_option( 'blog_icon' ) directly as @henry.wright mentions.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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 likeget_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 }