From 307979a247160893a6e21bad60abdddc4f99a4f0 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 23 Oct 2012 13:20:40 +0000 Subject: [PATCH] Avoid notices in _remove_theme_support(). Props alex-ye, SergeyBiryukov. fixes #22246 git-svn-id: https://develop.svn.wordpress.org/trunk@22274 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/theme.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 5992ff17a4..5c677a93fd 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1464,17 +1464,22 @@ function _remove_theme_support( $feature ) { switch ( $feature ) { case 'custom-header' : $support = get_theme_support( 'custom-header' ); - if ( $support[0]['wp-head-callback'] ) + if ( isset( $support[0]['wp-head-callback'] ) ) remove_action( 'wp_head', $support[0]['wp-head-callback'] ); - remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) ); - unset( $GLOBALS['custom_image_header'] ); + if ( isset( $GLOBALS['custom_image_header'] ) ) { + remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) ); + unset( $GLOBALS['custom_image_header'] ); + } break; case 'custom-background' : $support = get_theme_support( 'custom-background' ); - remove_action( 'wp_head', $support[0]['wp-head-callback'] ); - remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) ); - unset( $GLOBALS['custom_background'] ); + if ( isset( $support[0]['wp-head-callback'] ) ) + remove_action( 'wp_head', $support[0]['wp-head-callback'] ); + if ( isset( $GLOBALS['custom_background'] ) ) { + remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) ); + unset( $GLOBALS['custom_background'] ); + } break; }