[wp-trac] [WordPress Trac] #53770: Site logo missing in 5.8

WordPress Trac noreply at wordpress.org
Wed Jul 28 00:23:14 UTC 2021


#53770: Site logo missing in 5.8
------------------------------------------------+--------------------------
 Reporter:  eqwmo                               |       Owner:  (none)
     Type:  defect (bug)                        |      Status:  new
 Priority:  normal                              |   Milestone:  Awaiting
                                                |  Review
Component:  Customize                           |     Version:  5.8
 Severity:  normal                              |  Resolution:
 Keywords:  has-testing-info reporter-feedback  |     Focuses:
------------------------------------------------+--------------------------

Comment (by hellofromTonya):

 Reference: #53247 [51091]

 A change was made in WordPress 5.8 where `_override_custom_logo_theme_mod`
 is now registered to the `custom_logo` theme mod, i.e. filter
 `theme_mod_custom_logo`. In this callback, if the `site_logo` option
 exists, it is used instead of the `custom_logo` theme mod.

 This filter fires when the function `get_theme_mod()` runs, such as when
 running:
 {{{#!php
 get_theme_mod( 'custom_logo` );
 }}}

 For the Goran theme, this change does not affect it, as it's using the
 `site_logo` option and not the `custom_logo` theme mod.

 What about other themes?

 Let's examine Twenty Twenty One (TT1). It's using `the_custom_logo()`. The
 callstack:

 {{{#!php
 the_custom_logo()
 get_custom_logo()
 get_theme_mod( 'custom_logo' )
 apply_filter( 'theme_mod_custom_logo', ... )
 _override_custom_logo_theme_mod()
 }}}

 This works fine _except_ for when:

 1. TT1 is active and Logo is set, i.e. meaning both the `custom_logo`
 theme mod and `site_logo` are both set to the same ID.
 2. Switch to a different theme.
 3. Change the logo, i.e. meaning the `site_logo` is different from before
 and the current theme's mod option for `custom_logo` is saved (but TT1's
 remains the old one).
 4. Switch back to the TT1 theme. The Logo rendered is not the one in TT1's
 `custom_logo` theme mod but is the one in the `site_logo`.

 The options database values are correct, but running `get_theme_mod(
 'custom_logo' )` returns the `site_logo` option instead of the theme's
 mod.

 This means once you set a site logo, it'll stay the same when switching
 between themes. Looking in the database could cause confusion. But from a
 site owner point of view, they can set the logo once and not worry about
 switching themes changing the site logo unexpectedly.

 >I looked into the database. With WP 5.8, the custom_logo returned is from
 another theme's theme_mods_ in the options table. How is this possible?

 @jokanane I suspect this is what you're seeing when looking at the
 database in comparison to what is being rendered. Can you look at the
 `site_logo` option in the database and see if that is the logo ID that is
 being rendered?

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


More information about the wp-trac mailing list