From d52e37ea5edd6254b60c998e2a21dc99a57bc98b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 14 Mar 2019 21:09:47 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@44899 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-login.php | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/wp-login.php b/src/wp-login.php index 07cf87fcff..72fcae266d 100644 --- a/src/wp-login.php +++ b/src/wp-login.php @@ -113,13 +113,7 @@ function login_header( $title = 'Log In', $message = '', $wp_error = null ) { */ do_action( 'login_head' ); - if ( is_multisite() ) { - $login_header_url = network_home_url(); - $login_header_title = get_network()->site_name; - } else { - $login_header_url = __( 'https://wordpress.org/' ); - $login_header_title = __( 'Powered by WordPress' ); - } + $login_header_url = __( 'https://wordpress.org/' ); /** * Filters link URL of the header logo above login form. @@ -130,24 +124,34 @@ function login_header( $title = 'Log In', $message = '', $wp_error = null ) { */ $login_header_url = apply_filters( 'login_headerurl', $login_header_url ); + $login_header_title = ''; + /** * Filters the title attribute of the header logo above login form. * * @since 2.1.0 + * @deprecated 5.2.0 Use login_headertext * * @param string $login_header_title Login header logo title attribute. */ - $login_header_title = apply_filters( 'login_headertitle', $login_header_title ); + $login_header_title = apply_filters_deprecated( + 'login_headertitle', + array( $login_header_title ), + '5.2.0', + 'login_headertext', + __( 'Usage of the title attribute on the login logo is not recommended for accessibility reasons. Use the link text instead.' ) + ); - /* - * To match the URL/title set above, Multisite sites have the blog name, - * while single sites get the header title. + $login_header_text = empty( $login_header_title ) ? __( 'Powered by WordPress' ) : $login_header_title; + + /** + * Filters the link text of the header logo above the login form. + * + * @since 5.2.0 + * + * @param string $login_header_text The login header logo link text. */ - if ( is_multisite() ) { - $login_header_text = get_bloginfo( 'name', 'display' ); - } else { - $login_header_text = $login_header_title; - } + $login_header_text = apply_filters( 'login_headertext', $login_header_text ); $classes = array( 'login-action-' . $action, 'wp-core-ui' ); if ( is_rtl() ) { @@ -187,11 +191,8 @@ function login_header( $title = 'Log In', $message = '', $wp_error = null ) { do_action( 'login_header' ); ?>
-

+