Skip to content

Commit 1e34129

Browse files
committed
Script Loader: Disable script and style concatenation by default.
Flips the fallback in `script_concat_settings()` so an undefined `CONCATENATE_SCRIPTS` resolves to `false` instead of `true`, making `load-scripts.php` and `load-styles.php` opt-in. Sites that want the previous behaviour can define the constant as `true`. The concatenation code paths are unchanged, and the surrounding guard already forces the global to `false` outside of `is_admin()` and `login_init`, so only wp-admin and the login screen are affected. See #57548.
1 parent 2b0b3b8 commit 1e34129

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/wp-includes/script-loader.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
66
* define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and CSS, and disables compression and concatenation,
7-
* define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS,
7+
* define('CONCATENATE_SCRIPTS', true); enables concatenation of scripts and CSS in the admin and on the login screen (disabled by default),
88
* define('COMPRESS_SCRIPTS', false); disables compression of scripts,
99
* define('COMPRESS_CSS', false); disables compression of CSS,
1010
* define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate).
@@ -2476,7 +2476,7 @@ function script_concat_settings() {
24762476
$can_compress_scripts = ! wp_installing() && get_site_option( 'can_compress_scripts' );
24772477

24782478
if ( ! isset( $concatenate_scripts ) ) {
2479-
$concatenate_scripts = defined( 'CONCATENATE_SCRIPTS' ) ? CONCATENATE_SCRIPTS : true;
2479+
$concatenate_scripts = defined( 'CONCATENATE_SCRIPTS' ) ? CONCATENATE_SCRIPTS : false;
24802480
if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) {
24812481
$concatenate_scripts = false;
24822482
}

0 commit comments

Comments
 (0)