I18N: Do not reuse $theme variable name after loading a theme's functions.php file.
The file could declare its own `$theme` variable, which would override the one used in the `foreach` loop. To prevent this, call `wp_get_theme()` before loading the file and store the instance in a different variable. Props neo2k23, swissspidy. See #62244. Built from https://develop.svn.wordpress.org/trunk@59466 git-svn-id: http://core.svn.wordpress.org/trunk@58852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -679,14 +679,15 @@ $GLOBALS['wp_locale_switcher']->init();
|
||||
|
||||
// Load the functions for the active theme, for both parent and child theme if applicable.
|
||||
foreach ( wp_get_active_and_valid_themes() as $theme ) {
|
||||
$wp_theme = wp_get_theme( basename( $theme ) );
|
||||
|
||||
if ( file_exists( $theme . '/functions.php' ) ) {
|
||||
include $theme . '/functions.php';
|
||||
}
|
||||
|
||||
$theme = wp_get_theme( basename( $theme ) );
|
||||
$theme->load_textdomain();
|
||||
$wp_theme->load_textdomain();
|
||||
}
|
||||
unset( $theme );
|
||||
unset( $theme, $wp_theme );
|
||||
|
||||
/**
|
||||
* Fires after the theme is loaded.
|
||||
|
||||
Reference in New Issue
Block a user