Support » Themes and Templates » remove_theme_support() generates array index error

  • I am updating a Twenty-Eleven child theme to 3.4 (actually 3.4.1) and had used remove_custom_background() and remove_custom_image_header() to disable custom headers as the child theme defines a fixed header and background.

    I am trying to address the deprecated warning messages for remove_custom_background() and remove_custom_image_header() by using remove_theme_support('custom-background') and remove_theme_support('custom-header') but both generate a warnings:

    Notice:  Undefined index: wp-head-callback in C:\inetpub\wwwroot\wordpress\wp-includes\theme.php on line 1458
    Notice: Undefined index: custom_background in C:\inetpub\wwwroot\wordpress\wp-includes\theme.php on line 1460
    Notice: Undefined index: custom_image_header in C:\inetpub\wwwroot\wordpress\wp-includes\theme.php on line 1452

    Looking at the wordpress\wp-includes\theme.php code, it appears that the code checks for the array element before trying to use it in one case but not all!

    switch ( $feature ) {
    		case 'custom-header' :
    			$support = get_theme_support( 'custom-header' );
    			if ( $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'] );
    		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'] );

    The only way I’ve been able to remove these theme features in 3.4 is to do this:

    global $_wp_theme_features;

    Is anyone else successfully calling remove_theme_support()? If so, what am I doing wrong?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘remove_theme_support() generates array index error’ is closed to new replies.