From 88461977b1512c790512ae03821455047cbf57af Mon Sep 17 00:00:00 2001 From: danielbachhuber Date: Wed, 7 Jun 2023 20:09:23 +0000 Subject: [PATCH] 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 --- wp-includes/load.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/load.php b/wp-includes/load.php index 02bf0299bf..9780519856 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -948,6 +948,10 @@ function wp_get_active_and_valid_themes() { return $themes; } + if ( ! wp_using_themes() ) { + return $themes; + } + if ( TEMPLATEPATH !== STYLESHEETPATH ) { $themes[] = STYLESHEETPATH; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 70984b1d30..c9aafc73cb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.