Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54675 closed defect (bug) (fixed)

Add a filter to disable the login screen language dropdown

Reported by: audrasjb's profile audrasjb Owned by: audrasjb's profile audrasjb
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.9
Component: Login and Registration Keywords: has-patch needs-dev-note commit has-testing-instructions
Focuses: Cc:

Description

The login screen language dropdown was introduced in [52058].

On the Make/Core devnote, @rickcurran suggested we add a filter to allow developers to disable the language dropdown. The typical use case could be a plugin which already add the feature.

Related: #43700.
Follow-up to [52058].

Change History (15)

This ticket was mentioned in PR #2074 on WordPress/wordpress-develop by audrasjb.


3 years ago
#2

  • Keywords has-patch added; needs-patch removed

#3 @audrasjb
3 years ago

The PR above adds the filter.
It correctly disable the language switcher, using this hook:

add_filter( 'display_login_language_dropdown', '__return_false' );

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


3 years ago

#5 @hellofromTonya
3 years ago

  • Keywords needs-dev-note added
  • Milestone changed from Awaiting Review to 5.9
  • Type changed from feature request to defect (bug)

Pulling into 5.9 and changing the type to defect. It's not technically a bug, but rather an opportunity to provide the ability to turn off the feature introduced in 5.9.

This one is part of #43700, which has a dev note. Marking needs-dev-note as the new filter will need to be added to https://make.wordpress.org/core/2021/12/20/introducing-new-language-switcher-on-the-login-screen-in-wp-5-9/.

#6 @costdev
3 years ago

Test Report

Env

  • WordPress: trunk (with PR 2074 applied)
  • Browser: Chrome v96.0.4664.110
  • OS: Windows 10 (WSL2)
  • Theme: Twenty Twenty-Two
  • Block Editor
  • Plugin: None activated

Steps to test

  1. Load /wp-login.php.
  2. The languages dropdown should be visible.
  3. Add the following to Twenty Twenty-Two's functions.php file and Save:
    add_filter( 'display_login_language_dropdown', '__return_false' );
    
  4. Refresh /wp-login.php.
  5. The languages dropdown should no longer be visible.

Results

  • Before adding the filter, the languages dropdown was visible.
  • After adding the filter, the languages dropdown was no longer visible.
  • All works as expected. 👍
Last edited 3 years ago by costdev (previous) (diff)

hellofromtonya commented on PR #2074:


3 years ago
#7

@costdev did a test report https://core.trac.wordpress.org/ticket/54675#comment:6. Its as expected ✅

#8 @hellofromTonya
3 years ago

  • Keywords commit has-testing-instructions added

Marking PR 2074 for commit.

#9 @audrasjb
3 years ago

  • Owner set to audrasjb
  • Status changed from new to assigned

Self assigning for commit

#10 follow-up: @audrasjb
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 52404:

Login and registration: Add a filter to allow to disable the Login screen language dropdown.

This change introduces the display_login_language_dropdown filter which allows to disable the Login screen language dropdown.

Follow-up to [52058].

Props rickcurran, audrasjb, ocean90, hellofromtonya, costdev, johnbillion.
Fixes #54675.

#11 @audrasjb
3 years ago

In 52405:

Coding Standards: Remove unwanted whitespaces after [52404].

Follow-up to [52404].

See #54675.

This ticket was mentioned in Slack in #polyglots by amieiro. View the logs.


3 years ago

#14 in reply to: ↑ 10 ; follow-up: @rickcurran
3 years ago

Hi, sorry, not a huge issue but thought it worth highlighting here, I just went to apply this to a site running the latest RC4 release to test preventing the language dropdown from showing on the login page and it wasn't working for me. I then noticed that the filter names were subsequently renamed in another code change on 03/01/2022 to login_display_language_dropdown instead of the original display_login_language_dropdown that this ticket originally defined it as. It wasn't until I double-checked my wp-login.php file of my site that I noticed that it had changed.

Thanks!

Replying to audrasjb:

In 52404:

Login and registration: Add a filter to allow to disable the Login screen language dropdown.

This change introduces the display_login_language_dropdown filter which allows to disable the Login screen language dropdown.

Follow-up to [52058].

Props rickcurran, audrasjb, ocean90, hellofromtonya, costdev, johnbillion.
Fixes #54675.

#15 in reply to: ↑ 14 @SergeyBiryukov
3 years ago

Replying to rickcurran:

I then noticed that the filter names were subsequently renamed in another code change on 03/01/2022 to login_display_language_dropdown instead of the original display_login_language_dropdown that this ticket originally defined it as. It wasn't until I double-checked my wp-login.php file of my site that I noticed that it had changed.

Thanks for the comment! The filter names were indeed changed in #54696 for more consistency.

Note: See TracTickets for help on using tickets.