#58318 closed defect (bug) (fixed)
Remove `load_theme_textdomain()` calls from default themes
Reported by: | swissspidy | Owned by: | swissspidy |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | has-patch |
Focuses: | Cc: |
Description
Since WordPress 4.6 introduced just-in-time translation loading, themes and plugins no longer need to manually call load_theme_textdomain
/load_plugin_textdomain
, unless they are on a version prior to 4.6.
Still, for some reason the default themes before Twenty Twenty-Two still use load_theme_textdomain
, sometimes even pointing to a /languages
folder that doesn't actually exist.
Related: #34884
Suggestion:
- Remove
load_theme_textdomain()
call from Twenty Seventeen and up, since these themes all require at least WordPress 4.7 - On older default themes, only call
load_theme_textdomain()
conditionally depending on the WordPress version.
Attachments (1)
Change History (10)
#2
@
17 months ago
FWIW, we already had a dev note for this 7 years ago: https://make.wordpress.org/core/2016/07/06/i18n-improvements-in-4-6/
#3
@
17 months ago
- Milestone changed from Awaiting Review to 6.3
Nice catch, let's move this to milestone 6.3.
#4
@
17 months ago
I think it is worth writing a blog post about this. I had no idea about this change. I think flagging and the performance impact it might have would go a long way to get themes to stop using these functions.
Looking at the theme directory, seems to be lots of plugins there that use it. See https://www.wpdirectory.net/search/01H0Q50AEDHDWKN0TFDZ3BJZ5M
Including storefront, Astra and OceanWP, three of the largest themes in the repo.
#5
@
17 months ago
Sure we can mention this somewhere as a reminder. Not really a performance impact though
This ticket was mentioned in PR #4501 on WordPress/wordpress-develop by celestioushawk.
17 months ago
#6
- Keywords has-patch added; needs-patch removed
Remove explicit call to load_theme_textdomain()
after twentyseventeen
theme since they all require WordPress version 4.6 (just in time translation loading introduced) and above. Add a wp_version
conditional check for themes before twentyseventeen
for a call to load_theme_textdomain()
to be included.
Trac ticket: https://core.trac.wordpress.org/ticket/58318
#8
@
16 months ago
- Owner set to swissspidy
- Resolution set to fixed
- Status changed from new to closed
In 55929:
@swissspidy commented on PR #4501:
16 months ago
#9
Committed in https://core.trac.wordpress.org/changeset/55929
If we make this change, I would like to see a dev note, so it means that others do not make the same mistake.