Make WordPress Core


Ignore:
Timestamp:
10/21/2024 02:11:56 PM (14 months ago)
Author:
swissspidy
Message:

I18N: Fix script languages path on Multisite.

This is a follow-up to [59126] (itself a follow-up to [57922]), which caused a regression when determining the right path when loading script translations.

Props swissspidy, themes-1, staurand.
Fixes #62016.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/l10n.php

    r59157 r59264  
    11521152    $plugins_url = wp_parse_url( plugins_url() );
    11531153    $site_url    = wp_parse_url( site_url() );
     1154    $theme_root  = get_theme_root();
    11541155
    11551156    // If the host is the same or it's a relative URL.
     
    11681169
    11691170        /*
    1170          * Ensure correct languages path when using a custom `WP_PLUGIN_DIR` / `WP_PLUGIN_URL` configuration.
     1171         * Ensure correct languages path when using a custom `WP_PLUGIN_DIR` / `WP_PLUGIN_URL` configuration,
     1172         * a custom theme root, and/or using Multisite with subdirectories.
    11711173         * See https://core.trac.wordpress.org/ticket/60891 and https://core.trac.wordpress.org/ticket/62016.
    11721174         */
    1173         $plugins_dir = array_slice( explode( '/', $plugins_url['path'] ), 2 );
    1174         $plugins_dir = trim( $plugins_dir[0], '/' );
    1175         $dirname     = $plugins_dir === $relative[0] ? 'plugins' : 'themes';
     1175
     1176        $theme_dir = array_slice( explode( '/', $theme_root ), -1 );
     1177        $dirname   = $theme_dir[0] === $relative[0] ? 'themes' : 'plugins';
    11761178
    11771179        $languages_path = WP_LANG_DIR . '/' . $dirname;
Note: See TracChangeset for help on using the changeset viewer.