diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 9d43d1b2a2..9737fb3cb5 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -1194,13 +1194,20 @@ function get_header_image_tag( $attr = array() ) { $width = absint( $header->width ); $height = absint( $header->height ); + // Use alternative text assigned to the image, if available. Otherwise, leave it empty. + if ( ! empty( $header->attachment_id ) && is_string( get_post_meta( $header->attachment_id, '_wp_attachment_image_alt', true ) ) ) { + $alt = get_post_meta( $header->attachment_id, '_wp_attachment_image_alt', true ); + } else { + $alt = ''; + } + $attr = wp_parse_args( $attr, array( 'src' => $header->url, 'width' => $width, 'height' => $height, - 'alt' => get_bloginfo( 'name' ), + 'alt' => $alt, ) );