#44494 closed feature request (fixed)
Add option to hide en_US in wp_dropdown_languages()
| Reported by: | swissspidy | Owned by: | swissspidy |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.1 |
| Component: | I18N | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
While working on the Preferred Languages project I noticed that it's not possible to hide the English (United States) option in wp_dropdown_languages().
In my case, I do not need the en_US because of the way the UI works: When I do not pick a language from the dropdown, en_US will be the default. Screenshot: https://cloudup.com/cXhxw4KPqFc
While I added a workaround using JavaScript, I think there should be a) a show_option_en_US parameter or b) a filter (e.g. $output = apply_filters( 'wp_dropdown_languages', $output, $languages, $parsed_args )) at the end of the function. Or perhaps even both.
Attachments (3)
Change History (13)
#2
@
8 years ago
- Keywords has-patch needs-testing added; needs-patch good-first-bug removed
- Type defect (bug) → feature request
I've changed the ticket type to feature as it's not really a bug as nothing is broken here.
I've added a patch which adds an extra argument for en_US. Simple, but does the job.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
wp_dropdown_languages()already supports$argsso I'm in favour of supporting another argument in that array to exclude certain locales by slug or something.languagesis also already supported though; I suppose you could reverse engineer it so you get the full list list of locales, then remove en_US and then use the updated list (minus en_US) to request as those specific locales. Not ideal, but serves as a better work around than JavaScript perhaps.Ref: https://developer.wordpress.org/reference/functions/wp_dropdown_languages/