Make WordPress Core

Opened 6 years ago

Closed 4 years ago

Last modified 4 years ago

#43081 closed defect (bug) (invalid)

Custom logo issue in Customizer

Reported by: guido07111975's profile Guido07111975 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Customize Keywords:
Focuses: Cc:



Almost 2 years ago I've started a thread about an issue with the custom logo in customizer. Link:

Until now it's not fixed.

In short, this doesn't behave as expected:

<?php if ( has_custom_logo() ) : ?>
	<?php the_custom_logo(); ?>
<?php else : ?>
	<h1>Site Title</h1>
<?php endif; ?>

Once a custom logo is set, and removed again in the same session, Site Title and Tagline aren't displayed. You need to close and re-visit the customizer, to make Site Title and Tagline visible again.

It seems the custom logo stays active, after removing the logo (image) in the same session.


Change History (4)

#1 @lrdn
6 years ago

The custom logo setting uses the postMessage transport by default which requires changes to be handled manually using JavaScript. You can however simply override the transport setting with refresh to automatically reload the preview. In my opinion that's not a bug and won't require any changes to the WordPress core.


function custom_logo_setup()
        add_theme_support('custom-logo', array
                'width' => 250,
                'height' => 250,
                'flex-width' => true
add_action('after_setup_theme', 'custom_logo_setup');

function custom_logo_settings($wp_customize)
        $wp_customize->get_setting('custom_logo')->transport = 'refresh';
add_action('customize_register', 'custom_logo_settings');

#2 @Guido07111975
6 years ago

Hi @lrdn

Your fix works fine, so thank you for that.

I don't have enough knowledge to determine whether this should be fixed in core or not.. so let's wait what others say.

Thanks again :-)


#3 @dlh
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 4.9.1 deleted

I agree with comment:1 that the current behavior is expected given the use of the postMessage transport. Changing the setting to refresh is one way to work around the behavior if the theme isn't set up for postMessage. The default themes also showcase how the custom logo can be integrated with the Customizer's selective refresh framework.

#4 @dlh
4 years ago

#51015 was marked as a duplicate.

Note: See TracTickets for help on using tickets.