Avoid notices in _remove_theme_support(). Props alex-ye, SergeyBiryukov. fixes #22246

git-svn-id: http://core.svn.wordpress.org/trunk@22274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-10-23 13:20:40 +00:00
parent ae48899878
commit c344ce9cfb
1 changed files with 11 additions and 6 deletions

View File

@ -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;
}