diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index fa0c2856a1..0c8cd50e85 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -651,7 +651,12 @@ function wp_scripts_get_suffix( $type = '' ) { // Include an unmodified $wp_version. require ABSPATH . WPINC . '/version.php'; - $develop_src = str_contains( $wp_version, '-src' ); + /* + * Note: str_contains() is not used here, as this file can be included + * via wp-admin/load-scripts.php or wp-admin/load-styles.php, in which case + * the polyfills from wp-includes/compat.php are not loaded. + */ + $develop_src = false !== strpos( $wp_version, '-src' ); if ( ! defined( 'SCRIPT_DEBUG' ) ) { define( 'SCRIPT_DEBUG', $develop_src ); @@ -1480,7 +1485,12 @@ function wp_default_styles( $styles ) { require ABSPATH . WPINC . '/version.php'; if ( ! defined( 'SCRIPT_DEBUG' ) ) { - define( 'SCRIPT_DEBUG', str_contains( $wp_version, '-src' ) ); + /* + * Note: str_contains() is not used here, as this file can be included + * via wp-admin/load-scripts.php or wp-admin/load-styles.php, in which case + * the polyfills from wp-includes/compat.php are not loaded. + */ + define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) ); } $guessurl = site_url();