[wp-trac] [WordPress Trac] #60922: get_custom_logo returns an empty link when no logo image is set

WordPress Trac noreply at wordpress.org
Sun May 12 19:32:50 UTC 2024


#60922: get_custom_logo returns an empty link when no logo image is set
-------------------------------------------------+-------------------------
 Reporter:  afercia                              |       Owner:  joedolson
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  6.6
Component:  Themes                               |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback needs-        |     Focuses:
  testing                                        |  accessibility
-------------------------------------------------+-------------------------

Comment (by joedolson):

 So, this issue is actually specific to the logo block; it does not occur
 with other themes. The site logo block does not set the `custom_logo`
 theme mod; it instead sets an option 'site_logo' and overrides the theme
 mod with that option's value.

 While we should still create an exit to handle the case where
 `get_custom_logo()` returns an empty string, we should also add a handler
 like `_delete_attachment_theme_mod()` that removes the `site_logo` setting
 when the attachment is deleted. There are a number of existing handlers in
 `wp-includes\blocks\site-logo.php` that cover cases where the theme mod is
 updated, but none of them appear to handle the case where the image is
 deleted outside of the editor. That change probably needs to happen in
 Gutenberg.

 We should handle this in both `get_custom_logo()` and in
 `has_custom_logo()`, so that the checks match the real state. Commented on
 PR, @khokansardar.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60922#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list