From ed1653977970b3fd15435f303de52d396a9ad723 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 30 Sep 2024 14:59:18 +0000 Subject: [PATCH] I18N: Fix script languages path for themes. Remove hardcoded path added in [57922] which ignored the fact that themes can also use script translations. They should not be affected even if plugins are installed outside the typical `wp-content/plugins` location. Props itapress, swissspidy. Fixes #62016. Built from https://develop.svn.wordpress.org/trunk@59126 git-svn-id: http://core.svn.wordpress.org/trunk@58522 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/l10n.php | 10 +++++++++- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index 1f3532a40d..13d307fca9 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -1207,7 +1207,15 @@ function load_script_textdomain( $handle, $domain = 'default', $path = '' ) { $relative = trim( $relative, '/' ); $relative = explode( '/', $relative ); - $languages_path = WP_LANG_DIR . '/plugins'; + /* + * Ensure correct languages path when using a custom `WP_PLUGIN_DIR` / `WP_PLUGIN_URL` configuration. + * See https://core.trac.wordpress.org/ticket/60891 and https://core.trac.wordpress.org/ticket/62016. + */ + $plugins_dir = array_slice( explode( '/', $plugins_url['path'] ), 2 ); + $plugins_dir = trim( $plugins_dir[0], '/' ); + $dirname = $plugins_dir === $relative[0] ? 'plugins' : 'themes'; + + $languages_path = WP_LANG_DIR . '/' . $dirname; $relative = array_slice( $relative, 2 ); // Remove plugins/ or themes/. $relative = implode( '/', $relative ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 2b0f2a659c..05b1796e8e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-59125'; +$wp_version = '6.7-alpha-59126'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.