Make WordPress Core

Changeset 44899


Ignore:
Timestamp:
03/14/2019 09:09:47 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Acessibility: Remove title attribute in login_header().

  • Deprecate login_headertitle filter, introduce login_headertext as a replacement.
  • For backwards compatibility, if a login_headertitle is set, it will be used as link text.
  • Make the login header logo URL and text consistent between single site and Multisite.
  • Avoid ambiguity of where the WordPress logo points to; link to WordPress.org by default.
  • login_headerurl filter is still available to change the URL of the header logo.

Props afercia, pratikkry, chetan200891.
Fixes #42537.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-login.php

    r44895 r44899  
    114114    do_action( 'login_head' );
    115115
    116     if ( is_multisite() ) {
    117         $login_header_url   = network_home_url();
    118         $login_header_title = get_network()->site_name;
    119     } else {
    120         $login_header_url   = __( 'https://wordpress.org/' );
    121         $login_header_title = __( 'Powered by WordPress' );
    122     }
     116    $login_header_url = __( 'https://wordpress.org/' );
    123117
    124118    /**
     
    131125    $login_header_url = apply_filters( 'login_headerurl', $login_header_url );
    132126
     127    $login_header_title = '';
     128
    133129    /**
    134130     * Filters the title attribute of the header logo above login form.
    135131     *
    136132     * @since 2.1.0
     133     * @deprecated 5.2.0 Use login_headertext
    137134     *
    138135     * @param string $login_header_title Login header logo title attribute.
    139136     */
    140     $login_header_title = apply_filters( 'login_headertitle', $login_header_title );
    141 
    142     /*
    143      * To match the URL/title set above, Multisite sites have the blog name,
    144      * while single sites get the header title.
    145      */
    146     if ( is_multisite() ) {
    147         $login_header_text = get_bloginfo( 'name', 'display' );
    148     } else {
    149         $login_header_text = $login_header_title;
    150     }
     137    $login_header_title = apply_filters_deprecated(
     138        'login_headertitle',
     139        array( $login_header_title ),
     140        '5.2.0',
     141        'login_headertext',
     142        __( 'Usage of the title attribute on the login logo is not recommended for accessibility reasons. Use the link text instead.' )
     143    );
     144
     145    $login_header_text = empty( $login_header_title ) ? __( 'Powered by WordPress' ) : $login_header_title;
     146
     147    /**
     148     * Filters the link text of the header logo above the login form.
     149     *
     150     * @since 5.2.0
     151     *
     152     * @param string $login_header_text The login header logo link text.
     153     */
     154    $login_header_text = apply_filters( 'login_headertext', $login_header_text );
    151155
    152156    $classes = array( 'login-action-' . $action, 'wp-core-ui' );
     
    188192    ?>
    189193    <div id="login">
    190         <h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>"><?php echo $login_header_text; ?></a></h1>
     194        <h1><a href="<?php echo esc_url( $login_header_url ); ?>"><?php echo $login_header_text; ?></a></h1>
    191195    <?php
    192 
    193     unset( $login_header_url, $login_header_title );
    194 
    195196    /**
    196197     * Filters the message to display above the login form.
Note: See TracChangeset for help on using the changeset viewer.