Only pass arguments from the deprecated add_custom_background() or add_custom_image_header() to add_theme_support() if the argument was actually supplied. With [20212], default argument values (like wp-head-callback=_custom_background_cb) only work for arguments that were not explicitly set, so don't set empty values. see #20249.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-03-21 22:21:22 +00:00
parent 8750c95b4a
commit 6f9f33e399
1 changed files with 16 additions and 11 deletions

View File

@ -2996,11 +2996,14 @@ function get_current_theme() {
*/ */
function add_custom_image_header( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { function add_custom_image_header( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
_deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-header\', $args )' ); _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-header\', $args )' );
return add_theme_support( 'custom-header', array( $args = array();
'wp-head-callback' => $wp_head_callback, if ( $wp_head_callback )
'admin-head-callback' => $admin_head_callback, $args['wp-head-callback'] = $wp_head_callback;
'admin-preview-callback' => $admin_preview_callback, if ( $admin_head_callback )
) ); $args['admin-head-callback'] = $admin_head_callback;
if ( $admin_preview_callback )
$args['admin-preview-callback'] = $admin_preview_callback;
return add_theme_support( 'custom-background', $args );
} }
/** /**
@ -3032,12 +3035,14 @@ function remove_custom_image_header() {
*/ */
function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
_deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-background\', $args )' ); _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-background\', $args )' );
$args = array();
return add_theme_support( 'custom-background', array( if ( $wp_head_callback )
'wp-head-callback' => $wp_head_callback, $args['wp-head-callback'] = $wp_head_callback;
'admin-head-callback' => $admin_head_callback, if ( $admin_head_callback )
'admin-preview-callback' => $admin_preview_callback, $args['admin-head-callback'] = $admin_head_callback;
) ); if ( $admin_preview_callback )
$args['admin-preview-callback'] = $admin_preview_callback;
return add_theme_support( 'custom-background', $args );
} }
/** /**