- $this->add_tab( 'default', __('Default'), array( $this, 'tab_default_headers' ) );
+ // Remove the upload tab.
+ $this->remove_tab( 'upload-new' );
+ }
+
+ /**
+ * Prepares the control.
+ *
+ * If no tabs exist, removes the control from the manager.
+ *
+ * @since 3.4.2
+ */
+ public function prepare_control() {
+ global $custom_image_header;
+ if ( empty( $custom_image_header ) )
+ return parent::prepare_control();
+
+ // Process default headers and uploaded headers.
+ $custom_image_header->process_default_headers();
+ $this->default_headers = $custom_image_header->default_headers;
+ $this->uploaded_headers = get_uploaded_header_images();
+
+ if ( $this->default_headers )
+ $this->add_tab( 'default', __('Default'), array( $this, 'tab_default_headers' ) );
+
+ if ( ! $this->uploaded_headers )
+ $this->remove_tab( 'uploaded' );
+
+ return parent::prepare_control();