diff --git a/wp-admin/css/wp-admin.dev.css b/wp-admin/css/wp-admin.dev.css index 10d49560d4..eb841cbbab 100644 --- a/wp-admin/css/wp-admin.dev.css +++ b/wp-admin/css/wp-admin.dev.css @@ -4494,7 +4494,6 @@ span.imgedit-scale-warn { .appearance_page_custom-header #headimg { border: 1px solid #DFDFDF; - min-height: 100px; width: 100%; } diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index a57f529c50..89a0b423b3 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -188,7 +188,21 @@ class Custom_Image_Header { if ( isset( $_POST['resetheader'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); - remove_theme_mod( 'header_image' ); + $this->process_default_headers(); + $default = defined( 'HEADER_IMAGE' ) ? HEADER_IMAGE : ''; + $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); + foreach ( $this->default_headers as $header => $details ) { + if ( $details['url'] == $default ) { + $default_data = $details; + break; + } + } + set_theme_mod( 'header_image', $default ); + if ( empty( $default_data['width'] ) ) + $default_data['width'] = HEADER_IMAGE_WIDTH; + if ( empty( $default_data['height'] ) ) + $default_data['height'] = HEADER_IMAGE_HEIGHT; + set_theme_mod( 'header_image_data', (object) $default_data ); return; } @@ -225,10 +239,17 @@ class Custom_Image_Header { } else { $this->process_default_headers(); $uploaded = get_uploaded_header_images(); - if ( isset( $uploaded[$_POST['default-header']] ) ) + if ( isset( $uploaded[$_POST['default-header']] ) ) { set_theme_mod( 'header_image', esc_url( $uploaded[$_POST['default-header']]['url'] ) ); - elseif ( isset( $this->default_headers[$_POST['default-header']] ) ) + set_theme_mod( 'header_image_data', (object) $uploaded[$_POST['default-header']] ); + } elseif ( isset( $this->default_headers[$_POST['default-header']] ) ) { set_theme_mod( 'header_image', esc_url( $this->default_headers[$_POST['default-header']]['url'] ) ); + if ( empty( $this->default_headers[$_POST['default-header']]['width'] ) ) + $this->default_headers[$_POST['default-header']]['width'] = HEADER_IMAGE_WIDTH; + if ( empty( $this->default_headers[$_POST['default-header']]['height'] ) ) + $this->default_headers[$_POST['default-header']]['height'] = HEADER_IMAGE_HEIGHT; + set_theme_mod( 'header_image_data', (object) $this->default_headers[$_POST['default-header']] ); + } } } } @@ -289,7 +310,7 @@ class Custom_Image_Header { echo '
- %1$d × %2$d pixels will be used as-is.' ), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT ); ?>