Making WordPress.org

Changeset 12571


Ignore:
Timestamp:
05/04/2023 02:45:09 AM (3 years ago)
Author:
dd32
Message:

Login: Hide the custom language switcher on 2FA prompt screens, as it causes the 2FA login flow to break.

This moves the wp-login.php display of the langauge selector to being output from the core 'should the language switcher be displayed' filter, rather than on the following login_footer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions.php

    r12240 r12571  
    5252 */
    5353add_filter( 'show_admin_bar', '__return_false', 101 );
    54 
    55 /**
    56  * Disable the Core Language Selector on wp-login.php.
    57  */
    58 add_filter( 'login_display_language_dropdown', '__return_false' );
    5954
    6055/**
     
    320315 * Note: See the 'Locale Detection' plugin for the switching of the locale.
    321316 */
    322 function wporg_login_language_switcher() {
     317function wporg_login_language_switcher( $display = true ) {
    323318        $current_locale = get_locale();
     319
     320        /*
     321         * If something has explicitely disabled the switcher, don't show our version either.
     322         * This is used for when we're called from the 'login_display_language_dropdown' filter.
     323         */
     324        if ( ! $display ) {
     325                return $display;
     326        }
    324327
    325328        ?>
     
    355358        </script>
    356359        <?php
    357 }
    358 add_action( 'wp_footer', 'wporg_login_language_switcher', 1 );
    359 add_action( 'login_footer', 'wporg_login_language_switcher', 1 );
     360
     361        return false; // For the login_display_language_dropdown filter.
     362}
     363add_action( 'wp_footer', 'wporg_login_language_switcher', 1, 0 );
     364add_action( 'login_display_language_dropdown', 'wporg_login_language_switcher', 20 );
    360365
    361366/**
Note: See TracChangeset for help on using the changeset viewer.