From dd57074aedbdc4fd15208be4bb7d5cc860391703 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 3 May 2012 13:30:55 +0000 Subject: [PATCH] Make admin-head-callback optional for custom headers. Reverts part of [20684]. fixes #20603. git-svn-id: https://develop.svn.wordpress.org/trunk@20712 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/custom-header.php | 3 ++- wp-includes/theme.php | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 4791fa746f..83ab6ae618 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -91,7 +91,8 @@ class Custom_Image_Header { add_action("admin_head-$page", array(&$this, 'help') ); add_action("admin_head-$page", array(&$this, 'take_action'), 50); add_action("admin_head-$page", array(&$this, 'js'), 50); - add_action("admin_head-$page", $this->admin_header_callback, 51); + if ( $this->admin_header_callback ) + add_action("admin_head-$page", $this->admin_header_callback, 51); add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 ); add_filter( 'media_upload_tabs', array( $this, 'filter_upload_tabs' ) ); diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 0a4e7ce724..d9ac780f97 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1347,13 +1347,12 @@ 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'] && $args[0]['admin-head-callback'] ) { + if ( $args[0]['wp-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'] ); } } @@ -1557,7 +1556,6 @@ 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