#38168 closed defect (bug) (fixed)
custom-background class appear in body class attribute even if theme doesn't support it
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.2 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Customize | Keywords: | has-patch has-unit-tests |
Focuses: | template | Cc: |
Description (last modified by )
There is an issue when the current theme doesn't support the 'custom-background' feature but the data ( if previously added ) is in the database.
To be clear (sorry for my english):
- Add the theme support 'custom-background' for example:
add_theme_support( 'custom-background', apply_filters( 'twentyseventeen_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) );
- Select a color or a background image and check the body class attribute that has 'custom-background' class.
- Remove the previous code and check for the body class. It's still there.
Attachments (4)
Change History (21)
#1
@
9 years ago
- Keywords has-patch needs-testing added
- Milestone changed from Awaiting Review to 4.7
- Version changed from 4.6.1 to 3.0
@wido Thanks for the patch!
At a glance, this looks valid and the proposed patch makes sense.
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
9 years ago
This ticket was mentioned in Slack in #core by stevenkword. View the logs.
9 years ago
#7
@
8 years ago
38168.2.diff updates the tests because the new test theme doesn't support custom-background by default.
#8
@
8 years ago
- Keywords needs-refresh added
Hmm, the test doesn't work:
EF 2 / 2 (100%) Time: 3.44 seconds, Memory: 84.00MB There was 1 error: 1) Tests_Post_GetBodyClass::test_custom_background_class_is_added_when_theme_supports_it Undefined index: wp-head-callback /src/wp-includes/theme.php:2310 /src/wp-includes/theme.php:2266 /tests/phpunit/tests/post/getBodyClass.php:192 -- There was 1 failure: 1) Tests_Post_GetBodyClass::test_custom_background_class_is_not_added_when_theme_support_is_missing Failed asserting that true is false. /tests/phpunit/tests/post/getBodyClass.php:209
#10
@
7 years ago
The issue was in theme.php
, custom-header
has the fix but not custom-background
so now is fixed on the unit tests :-)
Check for current theme support custom-background