Opened 13 years ago
Closed 13 years ago
#20603 closed defect (bug) (fixed)
Warning error occurs on the default parameter of "admin-head-callback" in add_theme_support.
Reported by: | jim912 | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.4 | Priority: | high |
Severity: | major | Version: | 3.4 |
Component: | Themes | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
When you make settings of custom header using add_theme_support on functions.php of a theme, if you use default value without defining admin-head-callback, warning error occurs as follows on admin screen of custom header.
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '' not found or invalid function name in path-to-wordpress-root/wp-includes/plugin.php on line 403
To fix this, I think better to change default value of admin-head-callback into __return_false
, on /wp-includes/theme.php. Here's patch.
Attachments (1)
Change History (9)
#4
@
13 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In [20684]:
#5
@
13 years ago
- Priority changed from normal to high
- Resolution fixed deleted
- Severity changed from normal to major
- Status changed from closed to reopened
This change breaks backwards compatibility with themes that call add_custom_image_header()
with an empty wp_head_callback
which was previously quite valid.
In 3.3 we only added the hook onto wp_head if it wasn't empty.
With the change Custom Headers become disabled on all themes that don't need a wp_head callback which is a regression.
I think we can just revert the changes to wp-includes/theme.php
#7
@
13 years ago
The best change is revert the changes to wp-includes/theme.php and make admin-head-callback optional. There's really no reason to not make it optional — the admin preview (image div) callback is optional; the argument enforces admin_head CSS for a header when it may not be needed.
The main issue is that otherwise we would have to enforce admin-head-callback as the only required argument for both custom headers and custom backgrounds. This forces us to do some funky things in the just-in-time function and I don't find it to be necessary for what should be optional CSS.
In 3.3, admin-head-callback was required, and remains required by the Custom_Image_Header class. So the best thing to do would be to require it in _custom_header_background_just_in_time().