Script Loader: Disable script and style concatenation by default - #13090
Draft
haqadn wants to merge 1 commit into
Draft
Script Loader: Disable script and style concatenation by default#13090haqadn wants to merge 1 commit into
haqadn wants to merge 1 commit into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
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.
haqadn
force-pushed
the
57548-disable-concatenation-by-default
branch
from
August 16, 2026 23:02
b5d66ea to
1e34129
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trac ticket: https://core.trac.wordpress.org/ticket/57548
Flips the fallback in
script_concat_settings()so an undefinedCONCATENATE_SCRIPTSresolves tofalseinstead oftrue.load-scripts.phpandload-styles.phpbecome opt-in — sites that want the current behaviour candefine( 'CONCATENATE_SCRIPTS', true ).Scope is narrower than the constant's name suggests. The guard immediately below already forces the global to
falseoutside ofis_admin()andlogin_init, so only wp-admin and the login screen change. The concatenation code paths themselves are untouched.Two reasons to make this the default:
SCRIPT_DEBUGbeing ignored (#52879), translations not printing for concatenated handles (#50999), and"use strict"leaking between bundled scripts (#65515) are all conditions a stock install currently ships into. Defaulting off takes wp-admin off that path.The cold-cache performance trade-off is the open question here, and the benchmark numbers and the compression-dictionary discussion belong on the ticket rather than in this diff. Opening as a draft for that reason.
Notes about TinyMCE
This slightly changes TinyMCE's concatenation behaviour too, through a different mechanism than the rest of this ticket. TinyMCE's bundle isn't produced by
load-scripts.php— it's a static file built at release time. Concatenation only decides whether that prebuilt bundle is registered, or two separate files are.So with concatenation off, the bundled file stops loading, and TinyMCE core and the compat3x plugin load separately instead.
That sounds like a tiny loss until you look at what the bundle holds: 24 concatenated sources — core, the modern theme, and 22 editor plugins — of which only two are ever requested on a real admin screen. Measured on Add Post with a cold cache, concatenation on gives one request and off gives two, with none of the 22 plugins fetched either way. Loading TinyMCE isn't the same as initialising it, and the block editor doesn't initialise it until a Classic block is present.
The concatenation is effectively bundling two files, and shipping 22 unused ones to do it:
~295 KB less on first load.
Testing instructions
CONCATENATE_SCRIPTSnorSCRIPT_DEBUGdefined inwp-config.php.load-scripts.phporload-styles.php— every handle appears as its own<script src>or<link href>.define( 'CONCATENATE_SCRIPTS', true );towp-config.phpand reload the same screen. Bothload-scripts.phpandload-styles.phpshould reappear, confirming the opt-in path still works.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Making the change, running the test suite and confirming the pre-existing failures against baseline, and drafting this description. Reviewed by me.