Make WordPress Core

Opened 21 months ago

Last modified 21 months ago

#43081 new defect (bug)

Custom logo issue in Customizer

Reported by: Guido07111975 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.1
Component: Customize Keywords:
Focuses: Cc:
PR Number:



Almost 2 years ago I've started a thread about an issue with the custom logo in customizer. Link: https://wordpress.org/support/topic/custom-logo-issue-in-customizer/

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 (2)

#1 @lrdn
21 months 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
21 months 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 :-)


Note: See TracTickets for help on using tickets.