[wp-trac] [WordPress Trac] #64249: Automatic translation (JIT) loading doesn't work for network-activated plugins in multisite
WordPress Trac
noreply at wordpress.org
Thu Nov 13 11:50:57 UTC 2025
#64249: Automatic translation (JIT) loading doesn't work for network-activated
plugins in multisite
--------------------------+-----------------------------
Reporter: pelentak | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version: trunk
Severity: normal | Keywords: needs-patch
Focuses: multisite |
--------------------------+-----------------------------
== Description
The automatic just-in-time (JIT) translation loading introduced in [59461]
for WordPress 6.7+ only registers text domains for site-level active
plugins, but completely skips network-activated plugins in multisite
environments.
This causes PHP translations (via `__()`, `_e()`, etc.) to fail for
network-activated plugins, even when the plugin has correct Text Domain
and Domain Path headers and translation files are present. Interestingly,
JavaScript translations (`.json` files) continue to work correctly.
== Possible Root Cause
In wp-settings.php, the automatic translation registration code processes
plugins from `wp_get_active_and_valid_plugins()` but does not process
plugins from `wp_get_active_network_plugins()`.
The relevant code added in [59461] around line 380-390 of wp-settings.php:
{{{#!php
<?php
// Register plugin translations for active plugins
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
$plugin_data = get_plugin_data( $plugin, false, false );
if ( ! empty( $plugin_data['TextDomain'] ) && ! empty(
$plugin_data['DomainPath'] ) ) {
// Translation registration happens here
}
}
}}}
However, there is no equivalent loop for network-activated plugins loaded
earlier via `wp_get_active_network_plugins()`.
== Steps to Reproduce
Set up a WordPress Multisite installation (any configuration: subdirectory
or subdomain)
Create or install a plugin with:
Proper plugin headers including `Text Domain: my-plugin` and `Domain Path:
/languages`
Translation files in the plugin's `/languages` directory (e.g., `my-
plugin-de_DE.mo`)
PHP code using translation functions like `__('Text', 'my-plugin')`
Network Activate the plugin
Set the site language to match the translation file (e.g., German de_DE)
View the plugin's output on the front-end or admin
== Expected Behavior
The plugin's translations should load automatically without requiring
`load_plugin_textdomain()`, just as they do for site-level activated
plugins. The plugin should display translated text in German.
== Actual Behavior
The plugin displays English text (the original untranslated strings)
because the text domain was never registered during the WordPress
bootstrap process. Network-activated plugins must explicitly call
`load_plugin_textdomain()` as a workaround.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64249>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list