Load: Avoid loading a theme's functions.php when ! wp_using_themes().

Updates `wp_get_active_and_valid_themes()` to return early when `wp_using_themes()` returns `false`. This prevents a theme's `functions.php` from being loaded erroneously when the site isn't using themes.

Also adds `define( 'WP_USE_THEMES', true );` to the test suite bootstrap. Some tests randomly break without it because they were dependent on the previous buggy behavior.

Props bpayton, costdev, danielbachhuber, hellofromtonya, sergeybiryukov, spacedmonkey.
Fixes #57928.

Built from https://develop.svn.wordpress.org/trunk@55890


git-svn-id: http://core.svn.wordpress.org/trunk@55402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
danielbachhuber 2023-06-07 20:09:23 +00:00
parent 2d5927cb92
commit 88461977b1
2 changed files with 5 additions and 1 deletions

View File

@ -948,6 +948,10 @@ function wp_get_active_and_valid_themes() {
return $themes;
}
if ( ! wp_using_themes() ) {
return $themes;
}
if ( TEMPLATEPATH !== STYLESHEETPATH ) {
$themes[] = STYLESHEETPATH;
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-alpha-55889';
$wp_version = '6.3-alpha-55890';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.