From a5a40528c20b1128382292bd8216ef7d563e9db4 Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 2 May 2012 15:16:48 +0000 Subject: [PATCH] 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 --- wp-includes/deprecated.php | 11 +++++------ wp-includes/theme.php | 10 ++++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 13b6bff39..f5b6521c5 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -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 ); diff --git a/wp-includes/theme.php b/wp-includes/theme.php index d9ac780f9..0a4e7ce72 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -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