- require_once(ABSPATH . 'wp-admin/custom-header.php');
- $GLOBALS['custom_image_header'] =& new Custom_Image_Header($admin_header_callback, $admin_image_div_callback);
- add_action('admin_menu', array(&$GLOBALS['custom_image_header'], 'init'));
+
+ global $custom_image_header;
+
+ require_once( ABSPATH . 'wp-admin/custom-header.php' );
+ $custom_image_header = new Custom_Image_Header( $admin_header_callback, $admin_image_div_callback );
+ add_action( 'admin_menu', array( &$custom_image_header, 'init' ) );
+}
+
+/**
+ * Remove image header support.
+ *
+ * @since 3.1.0
+ * @see add_custom_image_header()
+ *
+ * @return bool Whether support was removed.
+ */
+function remove_custom_image_header() {
+ if ( ! current_theme_supports( 'custom-header' ) )
+ return false;
+
+ $callback = get_theme_support( 'custom-header' );
+ remove_action( 'wp_head', $callback[0]['callback'] );
+ _remove_theme_support( 'custom-header' );
+ remove_theme_support( 'custom-header-uploads' );
+
+ if ( is_admin() ) {
+ remove_action( 'admin_menu', array( &$GLOBALS['custom_image_header'], 'init' ) );
+ unset( $GLOBALS['custom_image_header'] );
+ }
+
+ return true;