WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 3 years ago

#29040 reopened defect (bug)

Customizer: Header Image not Updating when using static front page

Reported by: zhalsey Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.9
Component: Customize Keywords: reporter-feedback needs-patch
Focuses: javascript Cc:
PR Number:

Description (last modified by ocean90)

Using WordPress 4.0 Beta 2. Steps to reproduce:
only happens if theme has default header image
(with twenty fourteen)

  • Open Customizer
  • Open Header image section
  • Click on previously uploaded, theme default, or new uploaded image
  • current header updates in customizer controls and preview
  • changing header image activates the save and publish button, but after pressing it and closing customizer the header image is not changed
  • when returning to the customizer the newly uploaded image is not present, however it does appear in the media library
  • after switching themes and the switching back all images do show up

(in another theme which has several default images and no header text)

  • Open Customizer
  • Open Header image section
  • Click on previously uploaded, theme default, or new uploaded image
  • current header updates in customizer controls
  • customizer preview does not update image, even after triggering a preview refresh with another control
  • changing header image activates the save and publish button, but after pressing it and closing customizer the header image is not changed

Tried on Google Chrome and Safari on both Windows and Mac

Is not always reproducible with every theme, inconsistent results.

Change History (14)

#1 @ocean90
5 years ago

  • Description modified (diff)

#2 @jacklenox
5 years ago

I'm not able to reproduce this. Would you possibly be able to make a screencast?

#3 @celloexpressions
5 years ago

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

Can't reproduce the Twenty Fourteen version anymore - there is ocasionally some weirdness with header images but it typically gets resolved with a reload or switching themes and can't be reproduced consistently. The second part turned out just being a theme-specific issue.

#4 @sixhours
5 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

I'm still having this problem in two themes with default header images, Fictive and Ryu:

https://public-api.wordpress.com/rest/v1/themes/download/fictive.zip
https://public-api.wordpress.com/rest/v1/themes/download/ryu.zip

It happens regardless of whether the front page is static or displaying blog posts. Here is a screencast demonstrating the problem in Fictive using WP 4.1 in Chrome dev:

https://cloudup.com/c2YSKYHm45q

The video starts with a fresh copy of Fictive open in the Customizer.

#5 @ocean90
5 years ago

  • Milestone set to Awaiting Review

#6 follow-up: @helen
5 years ago

  • Keywords reporter-feedback added

Is this still an issue after changes in 4.1?

#7 in reply to: ↑ 6 @usability.idealist
4 years ago

Replying to helen:

Is this still an issue after changes in 4.1?

It seems to even exist in 4.2. Users keep reporting it in our ticket system, once in a while.

I've added a hackish solution for this (to the theme = CC 2) which is basically a refresh, fired whenever there is a change done to the header image in the Customizer, but that can only be considered as a VERY crude fix (like, could break any minute).

cu, w0lf.

Last edited 4 years ago by usability.idealist (previous) (diff)

#8 @carlalexander
4 years ago

Yup, I'm having this issue in 4.2.2. The issue is exactly as Caroline's video shows it.

I've narrowed it down set_header_image in Custom_Image_Header. The method receives default as the $choice. The method ends up doing nothing and just returning in this block of code:

if ( $uploaded && isset( $uploaded[ $choice ] ) ) {
	$header_image_data = $uploaded[ $choice ];
} else {
	$this->process_default_headers();

	if ( isset( $this->default_headers[ $choice ] ) )
		$header_image_data = $this->default_headers[ $choice ];
	else
		return;
}

There's no value for $this->default_headers[ $choice ] where $choice = 'default'. That's because the default-image in add_theme_support( 'custom-header' ) doesn't seem to make it there at all.

I did a bit more testing on that. It doesn't seem to be added to the default_headers array. For the function to behave as it should you'd need $this->default_headers['default'] to be equal to the default-image value. I don't think that was ever the case.

Switching themes probably works because it clears the theme_mods option in the database which reset the default header image.

#9 @carlalexander
4 years ago

I did some more digging. The get_default_header_images method merges the default-image into the default_headers array correctly. The issue seems to be that it isn't used by the Custom_Image_Header class. It's only used by WP_Customize_Control to display the image on the customizer page.

The issue can be solved by just using the get_default_header_images method in set_header_image as followed:

if ( $uploaded && isset( $uploaded[ $choice ] ) ) {
	$header_image_data = $uploaded[ $choice ];
} else {
	$default_headers = $this->get_default_header_images();

	if ( isset( $default_headers[ $choice ] ) )
		$header_image_data = $default_headers[ $choice ];
	else
		return;
}

What I can't tell is if this is a larger issue. It seems like get_default_header_images should be used at several other places. I'm also unclear why it isn't merged into the default_headers by default. It is a default header.

Either way, it seems like the relationship between get_default_header_header_images and process_default_headers should be tighter. I'll let someone with a better knowledge of the Customizer internals make that decision though.

#10 @davidakennedy
4 years ago

I just wanted to drop in and see I reproduced this while testing default themes for #36354. Both in Twenty Ten and Twenty Thirteen so far.

#11 @davidakennedy
4 years ago

I did some more testing on this, and it appears to be isolated to WordPress 4.4 and above.

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.


3 years ago

#13 @westonruter
3 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

#14 @smobers
3 years ago

i'm getting this problem too. Is there any solution or workaround?

Last edited 3 years ago by smobers (previous) (diff)
Note: See TracTickets for help on using tickets.