[wp-trac] [WordPress Trac] #53676: Default Custom Header image is not staying active

WordPress Trac noreply at wordpress.org
Fri Jul 16 00:35:34 UTC 2021


#53676: Default Custom Header image is not staying active
--------------------------+-----------------------------
 Reporter:  Andre Jutras  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Customize     |    Version:  5.7.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I remember this once long ago but cannot remember the issue. Working on a
 theme and noticed that when there are no additional images uploaded to the
 Header Image via the customizer, and when "hiding" the default header
 image, then reselecting the default one, click Save and then refresh, it
 does not stay active. I tried this by adding the header support in the
 Twenty Twenty One theme, nope, doesn't work there either.

 I tried this in WP 5.7.2 and also 5.8 RC3

 Test Code to add support to the 2021 theme function file:


 {{{
 // Setup the WordPress core custom header image.
 add_theme_support( 'custom-header', array(
   'width'         => 1920,
   'height'        => 800,
   'flex-height'   => true,
   'flex-width'    => true,
   'default-image' => get_template_directory_uri() .
 '/assets/images/header.jpg',
   'uploads'       => true,
 ) );
 }}}


 Then, to add it to the header.php template:


 {{{

 <?php if ( get_header_image() ) : ?>
     <img src="<?php header_image(); ?>">
 <?php endif; ?>
 }}}

 Head over to the customizer's Header Image tab and make sure no added
 images exist, except the default one.

 1. Make sure the default header is not active
 2. Select the default (suggested) header and save
 3. Refresh the full customizer window
 4. The default image shows as a thumbnail but is no longer active and is
 now Suggested.

 Even if I upload additional images, try them out, they work, however, if I
 once again select the default header image, it's a no-go on it.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53676>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list