Commit 3c3d1ac672 for wordpress.org

commit 3c3d1ac672059c969332b5d7a4d1695492ea4ad3
Author: westonruter <westonruter@git.wordpress.org>
Date:   Tue Oct 13 04:13:58 2026 +0000

    Script Loader: Disable script/style concatenation by default.

    Scripts and styles in the admin and on the login screen are no longer concatenated by default. When the `CONCATENATE_SCRIPTS` constant is not defined, `wp_should_concatenate_admin_scripts()` now returns `false`, so `load-scripts.php` and `load-styles.php` are only used when a site opts in with `define( 'CONCATENATE_SCRIPTS', true )`. This is the next step toward retiring concatenation. It also puts into effect the prefetching of the admin's assets added in r64120, which only applies when concatenation is off. With an empty browser cache, logging in and then opening the Dashboard, the Posts list and the block editor was measured to be faster this way than with concatenation on.

    TinyMCE is now always registered as two separate files instead of the prebuilt `wp-tinymce.js` bundle: TinyMCE core and the compat3x plugin. The bundle was registered only when scripts were both concatenated and compressed, and since r43580 and r44651 the `$compress_scripts` global has not compressed anything, so the registration no longer depends on either. The block editor loads TinyMCE on every screen but initializes it only when a Classic block is edited, so it now downloads 369 KB for the two files instead of 671 KB for the bundle, which also holds the theme and all 22 plugins. When TinyMCE is initialized, in the classic editor or for a Classic block, it now requests them itself and takes longer to become ready, a cost deemed acceptable since the role TinyMCE is increasingly diminished. A site can still register the bundle under the `wp-tinymce` handle. The unused second parameter of `wp_register_tinymce_scripts()` is deprecated.

    Developed in https://github.com/WordPress/wordpress-develop/pull/13090.
    Follow-up to r43580, r44114, r44651, r64120.

    Props adnan007, westonruter.
    See #57548, #66053.

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


    git-svn-id: http://core.svn.wordpress.org/trunk@63470 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php
index 928081cbc0..981d29379f 100644
--- a/wp-includes/class-wp-editor.php
+++ b/wp-includes/class-wp-editor.php
@@ -1541,7 +1541,7 @@ final class _WP_Editors {
 		$wp_scripts = wp_scripts();

 		$wp_scripts->remove( 'wp-tinymce' );
-		wp_register_tinymce_scripts( $wp_scripts, true );
+		wp_register_tinymce_scripts( $wp_scripts );
 	}

 	/**
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 2d839af4a1..28772b6534 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -4,7 +4,7 @@
  *
  * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
  * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and CSS, and disables compression and concatenation,
- * define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS,
+ * define('CONCATENATE_SCRIPTS', true); enables concatenation of scripts and CSS in the admin and on the login screen (disabled by default),
  * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
  * define('COMPRESS_CSS', false); disables compression of CSS,
  * define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate).
@@ -37,35 +37,42 @@ require ABSPATH . WPINC . '/functions.wp-styles.php';
 /**
  * Registers TinyMCE scripts.
  *
+ * TinyMCE core and the compat3x plugin are registered as separate files. TinyMCE loads its theme
+ * and any other plugins itself when an editor is initialized. The `wp-tinymce.js` bundle of all of
+ * them is no longer registered, but it can still be registered in their place under the
+ * `wp-tinymce` handle.
+ *
  * @since 5.0.0
+ * @since 7.2.0 The `wp-tinymce.js` bundle is no longer registered, regardless of whether scripts
+ *              are concatenated or compressed.
+ * @since 7.2.0 The `$force_uncompressed` parameter was deprecated and renamed to `$deprecated`.
  *
  * @global string $tinymce_version
- * @global bool   $concatenate_scripts
- * @global bool   $compress_scripts
  *
- * @param WP_Scripts $scripts            WP_Scripts object.
- * @param bool       $force_uncompressed Whether to forcibly prevent gzip compression. Default false.
+ * @param WP_Scripts $scripts    WP_Scripts object.
+ * @param bool       $deprecated Not used.
+ *
+ * @phpstan-param false $deprecated
  */
-function wp_register_tinymce_scripts( $scripts, $force_uncompressed = false ) {
-	global $tinymce_version, $concatenate_scripts, $compress_scripts;
+function wp_register_tinymce_scripts( $scripts, $deprecated = false ): void {
+	global $tinymce_version;
+
+	if ( false !== $deprecated ) {
+		_deprecated_argument( __FUNCTION__, '7.2.0' );
+	}

 	$suffix     = wp_scripts_get_suffix();
 	$dev_suffix = wp_scripts_get_suffix( 'dev' );

-	script_concat_settings();
-
-	$compressed = $compress_scripts && $concatenate_scripts && ! $force_uncompressed;
-
 	/*
-	 * Load tinymce.js when running from /src, otherwise load wp-tinymce.js (in production)
-	 * or tinymce.min.js (when SCRIPT_DEBUG is true).
+	 * This no longer depends on the concatenation settings, but it is where an admin screen has
+	 * settled them until now, which the 'wp_should_concatenate_admin_scripts' filter documents.
 	 */
-	if ( $compressed ) {
-		$scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.js', array(), $tinymce_version );
-	} else {
-		$scripts->add( 'wp-tinymce-root', includes_url( 'js/tinymce/' ) . "tinymce$dev_suffix.js", array(), $tinymce_version );
-		$scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . "plugins/compat3x/plugin$dev_suffix.js", array( 'wp-tinymce-root' ), $tinymce_version );
-	}
+	script_concat_settings();
+
+	// Load tinymce.js when running from /src, otherwise tinymce.min.js.
+	$scripts->add( 'wp-tinymce-root', includes_url( 'js/tinymce/' ) . "tinymce$dev_suffix.js", array(), $tinymce_version );
+	$scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . "plugins/compat3x/plugin$dev_suffix.js", array( 'wp-tinymce-root' ), $tinymce_version );

 	$scripts->add( 'wp-tinymce-lists', includes_url( "js/tinymce/plugins/lists/plugin$suffix.js" ), array( 'wp-tinymce' ), $tinymce_version );
 }
@@ -2498,7 +2505,7 @@ function script_concat_settings() {
 /**
  * Determines whether scripts and styles are concatenated on admin screens and the login screen.
  *
- * Concatenation is on unless the `CONCATENATE_SCRIPTS` constant turns it off, and `SCRIPT_DEBUG`
+ * Concatenation is off unless the `CONCATENATE_SCRIPTS` constant turns it on, and `SCRIPT_DEBUG`
  * turns it off regardless. Scripts and styles are never concatenated elsewhere.
  *
  * This is the default that script_concat_settings() gives the `$concatenate_scripts` global when
@@ -2515,7 +2522,7 @@ function script_concat_settings() {
  * @return bool Whether scripts and styles are concatenated on admin screens and the login screen.
  */
 function wp_should_concatenate_admin_scripts(): bool {
-	$concatenate = ( defined( 'CONCATENATE_SCRIPTS' ) ? (bool) CONCATENATE_SCRIPTS : true )
+	$concatenate = ( defined( 'CONCATENATE_SCRIPTS' ) ? (bool) CONCATENATE_SCRIPTS : false )
 		&& ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG );

 	/**
@@ -2532,8 +2539,8 @@ function wp_should_concatenate_admin_scripts(): bool {
 	 *
 	 * @since 7.2.0
 	 *
-	 * @param bool $concatenate Whether scripts and styles are concatenated. Default true, unless the
-	 *                          `CONCATENATE_SCRIPTS` constant is false or `SCRIPT_DEBUG` is true.
+	 * @param bool $concatenate Whether scripts and styles are concatenated. Default false, unless the
+	 *                          `CONCATENATE_SCRIPTS` constant is true and `SCRIPT_DEBUG` is not.
 	 */
 	return (bool) apply_filters( 'wp_should_concatenate_admin_scripts', $concatenate );
 }
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 20b2923bfa..0e4a084a43 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-64319';
+$wp_version = '7.2-alpha-64320';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.