Require both wp-head-callback and admin-head-callback for custom header theme support. fixes #20603.

git-svn-id: http://core.svn.wordpress.org/trunk@20684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-05-02 15:16:48 +00:00
parent bd1224eacf
commit a5a40528c2
2 changed files with 11 additions and 10 deletions

View File

@ -3022,13 +3022,12 @@ function clean_pre($matches) {
* @param callback $admin_head_callback Call on custom header administration screen.
* @param callback $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional.
*/
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 )' );
$args = array();
if ( $wp_head_callback )
$args['wp-head-callback'] = $wp_head_callback;
if ( $admin_head_callback )
$args['admin-head-callback'] = $admin_head_callback;
$args = array(
'wp-head-callback' => $wp_head_callback,
'admin-head-callback' => $admin_head_callback,
);
if ( $admin_preview_callback )
$args['admin-preview-callback'] = $admin_preview_callback;
return add_theme_support( 'custom-header', $args );

View File

@ -1347,12 +1347,13 @@ function _custom_header_background_just_in_time() {
add_theme_support( 'custom-header', array( '__jit' => true ) );
$args = get_theme_support( 'custom-header' );
if ( $args[0]['wp-head-callback'] )
if ( $args[0]['wp-head-callback'] && $args[0]['admin-head-callback'] ) {
add_action( 'wp_head', $args[0]['wp-head-callback'] );
if ( is_admin() ) {
require_once( ABSPATH . 'wp-admin/custom-header.php' );
$custom_image_header = new Custom_Image_Header( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] );
if ( is_admin() ) {
require_once( ABSPATH . 'wp-admin/custom-header.php' );
$custom_image_header = new Custom_Image_Header( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] );
}
}
}
@ -1556,6 +1557,7 @@ function check_theme_switched() {
if ( $stylesheet = get_option( 'theme_switched' ) ) {
$old_theme = wp_get_theme( $stylesheet );
if ( $old_theme->exists() )
do_action( 'after_switch_theme', $old_theme->get('Name'), $old_theme );
else