Make WordPress Core

Ticket #37011: 37011.4.diff

File 37011.4.diff, 1.2 KB (added by SergeyBiryukov, 3 years ago)
  • src/wp-includes/general-template.php

     
    965965                        'class' => 'custom-logo',
    966966                );
    967967
    968                 /*
    969                  * If the logo alt attribute is empty, get the site title and explicitly pass it
    970                  * to the attributes used by wp_get_attachment_image().
    971                  */
    972                 $image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true );
    973                 if ( empty( $image_alt ) ) {
    974                         $custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' );
     968                if ( is_front_page() ) {
     969                        /*
     970                         * If on the home page, set the logo alt attribute to an empty string,
     971                         * as the image is decorative and doesn't need its purpose to be described.
     972                         */
     973                        $custom_logo_attr['alt'] = '';
     974                } else {
     975                        /*
     976                         * If the logo alt attribute is empty, get the site title and explicitly pass it
     977                         * to the attributes used by wp_get_attachment_image().
     978                         */
     979                        $image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true );
     980                        if ( empty( $image_alt ) ) {
     981                                $custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' );
     982                        }
    975983                }
    976984
    977985                /*