[wp-trac] [WordPress Trac] #63725: Theme textdomain not loaded, if plugin used the textdomain before
WordPress Trac
noreply at wordpress.org
Sat Jul 19 14:42:14 UTC 2025
#63725: Theme textdomain not loaded, if plugin used the textdomain before
--------------------------+-----------------------------
Reporter: kkmuffme | Owner: swissspidy
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version:
Severity: blocker | Keywords:
Focuses: |
--------------------------+-----------------------------
If a plugin uses the same textdomain as a theme, the theme's textdomain
path is not loaded and still requires manually calling
load_theme_textdomain()
This is because of:
https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes
/class-wp-theme.php#L1522
This means that themes' still must call load_theme_textdomain() themselves
to avoid plugins accidentally hijacking their textdomain and their
translations not getting loaded correctly.
While generally this isn't an issue (since it not something that should be
done/happen) that plugins use the same textdomain as a theme, the real
world use cases where this happens all the time:
1) miss-spellings. e.g. plugin has textdomain foo-bar, theme uses foobar.
If the plugin has a single string with the wrong textdomain, the problem
happens
2) copied code (e.g. plugin authors copied or reused part of a theme
without changing the textdomain)
3) customizations: end-users (and developers) might copy strings from
themes to plugins as a first step of customization. This will cause the
theme's textdomain to not load correctly.
Why this is marked as "blocker":
by removing "load_theme_textdomain" in a theme since WP 6.8 for a theme,
theme authors get loads of support requests due to translations not
loading due to no fault of their own - but bc plugins are using the wrong
textdomain (accidentally).
This means for now, the recommended solution for themes is to keep their
"load_theme_textdomain" until that issue is resolved.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63725>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list