Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #60922, comment 15


Ignore:
Timestamp:
05/16/2024 02:49:34 PM (19 months ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #60922, comment 15

    initial v1  
    44After some more debugging in a coding session with @afercia, it looks like there is a difference between  how Site Logo is handled for classic themes and block themes:
    55* For classic themes, when deleting an image previously set as the site logo, the `custom_logo` theme mod is properly cleared by the `_delete_attachment_theme_mod()` function, hooked to `delete_attachment`.
    6 * For block themes, it's a bit more complicated: the Site Logo block uses a different data source, a `site_logo` option instead of a theme mod (see [https://github.com/WordPress/gutenberg/issues/32065 GB #32065]), and contains some code to sync between the two. The option is supposed to be cleared by `_delete_site_logo_on_remove_custom_logo()` when the theme mod is removed, but that does not happen when deleting the attachment. It [source:tags/6.5/src/wp-includes/theme.php?marks=3446#L3439 this conditional] is adjusted to also take the `site_logo` option into account, then the option can be properly cleared too.
     6* For block themes, it's a bit more complicated: the Site Logo block uses a different data source, a `site_logo` option instead of a theme mod (see [https://github.com/WordPress/gutenberg/issues/32065 GB #32065]), and contains some code to sync between the two. The option is supposed to be cleared by `_delete_site_logo_on_remove_custom_logo()` when the theme mod is removed, but that does not happen when deleting the attachment. If [source:tags/6.5/src/wp-includes/theme.php?marks=3446#L3439 this conditional] is adjusted to also take the `site_logo` option into account, then the option can be properly cleared too.
    77
    88To summarize, while the existing PR essentially fixes the symptom, it might still be good to go, as it does make `get_custom_logo()` and `has_custom_logo()` more future-proof.