[wp-trac] [WordPress Trac] #28687: Removing background image and/or reverting background color to default doesn't remove custom-background body class and remove theme mods
noreply at wordpress.org
Tue Jan 20 20:21:57 UTC 2015
#28687: Removing background image and/or reverting background color to default
doesn't remove custom-background body class and remove theme mods
Reporter: slobodanmanic | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.2
Component: Themes | Version: 3.9
Severity: normal | Resolution:
Keywords: | Focuses:
Comment (by slobodanmanic):
Replying to [comment:7 obenland]:
> slobodanmanic, have you had a chance to take another look?
Can I get your opinion?
28687-3.diff is similar to 28687-2.diff, with one extra check and, if you
agree with the implementation is the only file that needs to be changed.
Compared to current version of the file in trunk, it will now:
1. Check if get_theme_mod( 'background_color' ) is set
2. Check if its value is not equal to theme default
3. (And check if there's a background image, which is all it currently
Theme mods are still not deleted and set to empty string instead, but
.custom-background class will not be applied if both color and image are
not set, or if color is set to theme default value.
Deleting theme mods when saving them from Custom Background page is not a
problem, but I just can't figure it out when doing it from Customizer. I'd
love to figure it out, but after looking at this for a while, I think that
* Removing theme these two theme mods is necessary at all, since empty
values do the trick OR
* Removing background_image theme mod should also automatically remove
background_repeat, background_position_x and background_attachment, and
not leave them as they are, since they are tied to the image that was used
Let me know what you think, and if you have an idea how to remove
background_image theme mod when Customizer saves after you removed
background image, please let me know.
I tried adding remove_theme_mod to update in
WP_Customize_Background_Image_Setting class, but that didn't work.
Ticket URL: <https://core.trac.wordpress.org/ticket/28687#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac