Commit Graph

2530 Commits

Author SHA1 Message Date
Weston Ruter
4a1a88562b Script Loader: Move wp_load_classic_theme_block_styles_on_demand() from init to wp_default_styles.
This ensures the filters to opt in to loading separate block styles on demand are added at the moment `WP_Styles` is constructed. This accounts for styles being registered at the `init` action before `register_core_block_style_handles()` runs at priority 9. Without this, the `wp-block-library` stylesheet may get registered with the full combined block styles as `style.css` instead of just `common.css`, due to `wp_should_load_block_assets_on_demand()` still returning false. The `wp_default_styles` action still runs during `init`.

Developed in https://github.com/WordPress/wordpress-develop/pull/11232

Follow-up to r61008.

Props westonruter, adamsilverstein.
See #64099.
Fixes #64846.

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


git-svn-id: http://core.svn.wordpress.org/trunk@61263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-03-12 05:45:46 +00:00
Weston Ruter
0c43da9ee1 Script Loader: Refine hoisted stylesheet ordering to preserve original CSS cascade in classic themes.
This introduces placeholder inline `STYLE` tags in the `HEAD` which are used to accurately locate hoisted styles which were printed in the footer. This improves the robustness of the hoisting logic. A style placeholder had been used previously in the inline style for `wp-block-library` for placing core block styles, and new placeholders are added for global styles and non-core block styles.

Furthermore, this fixes the cascade for inline styles added to `wp-block-library`. When separate block styles are not used, these styles would have appeared after the single combined `wp-block-library`. However, in 6.9 the order changed so that separate block styles would appear after. To preserve the original cascade, this splits the `wp-block-library` inline style: the first half (likely just the inlined `block-library/common.css`) appears before the block styles, and the remainder appears in a new `STYLE#wp-block-library-inline-css-extra` element.

Developed in https://github.com/WordPress/wordpress-develop/pull/10875

Follow-up to r61554, r61174, r61122, r61076, r61008.

Props westonruter, joefusco, adamsilverstein, ocean90, mmorris8, ozgursar, vanonsopensource, xwolf, immeet94, george9, joezappie, jorbin, sajib1223, sabernhardt.
See #64099, #64354, #64150, #43258.
Fixes #64389.

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


git-svn-id: http://core.svn.wordpress.org/trunk@61227 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-03-11 20:57:45 +00:00
Adam Silverstein
e6427e904e Editor: backport client side media PHP changes to core.
Bring over the changes required to implement client side media in core. This feature recently graduated from experiments and is ready for testing in beta.

Props adamsilverstein, westonruter, mamaduka, mukesh27, swissspidy, andrewserong, ellatrix, ramonjd.
Fixes #62243.


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


git-svn-id: http://core.svn.wordpress.org/trunk@61011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-20 11:52:24 +00:00
desrosj
96a5cbf62c External Libraries: Upgrade backbone to 1.6.1.
This is a minor bugfix release. 

Props vipulgupta003.
Fixes #63763.
Built from https://develop.svn.wordpress.org/trunk@61686


git-svn-id: http://core.svn.wordpress.org/trunk@60994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-19 03:40:52 +00:00
desrosj
f3fc4e97b0 External Libraries: Update lodash to 4.17.23.
A full list of changes between `4.17.21` and `4.17.23` can be found on GitHub: https://github.com/lodash/lodash/compare/4.17.21...4.17.23.

Props nimeshatxecurify, peterwilsoncc.
Fixes #64664.
Built from https://develop.svn.wordpress.org/trunk@61684


git-svn-id: http://core.svn.wordpress.org/trunk@60992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-19 03:28:49 +00:00
joedolson
b9dd8f612b Admin: Apply scheme styles in non-admin admin screens.
Adds the admin-scheme styles as a dependency for the login and install styles. This is to ensure the CSS variables are available to the login, installation, database repair and upgrade screens.

Modifies the display of notices in the login styles to match those in the new default scheme, "modern".

Props peterwilsoncc, wildworks, westonruter, mukesh27, fabiankaegy, audrasjb, huzaifaalmesbah, sabernhardt, presskopp, SirLouen, ellatrix, nendeb55, neo2k23, jsmansart, joedolson.
Fixes #64640, #64548. See #64308.
Built from https://develop.svn.wordpress.org/trunk@61681


git-svn-id: http://core.svn.wordpress.org/trunk@60989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-18 21:14:48 +00:00
fabiankaegy
74089b9eb1 Admin: Change the default admin color scheme to Modern.
Rename the 'Modern' color scheme to 'Default' and the previous 'Default' scheme to 'Fresh'. Update all fallback references from 'fresh' to 'modern' across admin headers, the Customizer, the color scheme picker, the script loader, and user functions.

Add an upgrade routine in `upgrade_700()` to migrate existing users with the 'fresh' admin color to 'modern'.

Props fabiankaegy, audrasjb, mukesh27, westonruter, peterwilsoncc, jorbin, sabernhardt, joedolson, phpbits.
Fixes #64546.


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


git-svn-id: http://core.svn.wordpress.org/trunk@60955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-15 08:02:41 +00:00
Weston Ruter
afa47e5562 Code Editor: Switch from Esprima to Espree for JavaScript linting in CodeMirror.
Esprima is no longer maintained, and it does not support the latest JavaScript features in ES11, as Espree does.

- **New Linter Integration:** Introduces `src/js/_enqueues/vendor/codemirror/javascript-lint.js` using `espree` for parsing and error reporting, replacing the dependency on `jshint` and `esprima` scripts.
- **Script Modules:** Registers `espree` as a script module and leverages the `module_dependencies` argument in `wp_register_script()` to ensure `espree` is available as a dynamic import.
- **Editor Settings:** Updates `wp_get_code_editor_settings()` to use ES11 (ECMAScript 2020) defaults and synchronizes JSHint settings from `.jshintrc` for compatibility.
- **Editable Extensions:** Adds `.mjs` to the list of editable file extensions for plugins and themes.
- **Deprecations:** Marks `esprima` and `jshint` script handles as deprecated.
- **Build Tools:** Updates Webpack configuration to bundle `espree` as a module and use the new local `javascript-lint.js`.

Developed in https://github.com/WordPress/wordpress-develop/pull/10806

Follow-up to [61587], [61544], [61539], [42547].

Props westonruter, jonsurrell.
See #64562, #61500, #48456, #42850.
Fixes #64558.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-10 22:30:53 +00:00
Weston Ruter
7e270ecd86 Script Loader: Preserve original CSS cascade for classic themes when hoisting late-printed styles.
This refactors `wp_hoist_late_printed_styles()` to strictly preserve the classic theme CSS cascade when moving styles from `wp_footer` to the `HEAD`. Previously, hoisted styles were appended in an order closer to the CSS cascade for block themes, potentially causing specificity issues for CSS selectors written for the previous cascade. This is intended to eliminate the need for sites which upgraded to 6.9 to apply a hotfix involving `add_filter( 'should_load_separate_core_block_assets', '__return_false' )` to disable the optimization. 

Key changes:
* Identifies styles enqueued during `enqueue_block_assets`.
* Separates core block styles from third-party block styles.
* Inserts core block styles immediately after `wp-block-library`.
* Inserts third-party block styles after `classic-theme-styles`.
* Inserts `global-styles` after all `enqueue_block_assets` styles.

This ensures the following order is maintained:
1. Core block library.
2. Core block styles.
3. Classic theme styles.
4. Third-party block styles.
5. Global styles.

Developed in https://github.com/WordPress/wordpress-develop/pull/10601

Follow-up to [61174], [61122], [61076], [61008].

Props westonruter, wildworks, jorbin, peterwilsoncc, sabernhardt, audrasjb, pmbs, threadi, madhavishah01, raftaar1191, noruzzaman, ozgursar.
See #64099, #64150, #43258.
Fixes #64354.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-29 18:15:42 +00:00
Weston Ruter
95787d9d3c External Libraries: Upgrade CodeMirror to latest v5 in addition to updating CSSLint, Esprima, HTMLHint, and JSONLint.
This installs npm packages for `codemirror`, `csslint`, `esprima`, `htmlhint`, and `jsonlint` to replace the libraries which had been copied into SVN. A new `grunt build:codemirror` task is responsible for building CodeMirror as part of the build process. This finally revisits the original CodeMirror integration which was originally developed in the [https://github.com/WordPress/better-code-editing/ Better Code Editing] feature plugin in 2017.

||= Package  =||= Old Version        =||= New Version =||
|| codemirror || 5.29.1-alpha-ee20357 || 5.65.20       ||
|| esprima    || 4.0.0                || 4.0.1         ||
|| jsonlint   || 1.6.2                || 1.6.3         ||
|| htmlhint   || 0.9.14-xwp           || 1.8.0         ||

Follow-up to [41376].

Props westonruter, jonsurrell, tobiasbg, desrosj, adamsilverstein, WraithKenny, rafa8626, netweb.
See #12423.
Fixes #48456, #41870.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-27 19:04:47 +00:00
jonsurrell
2e6fb80a0e Script Loader: Deprecate wp_sanitize_script_attributes().
The function is no longer used by WordPress and better alternatives are available: `wp_get_script_tag()` and `wp_get_inline_script_tag()`.

Developed in https://github.com/WordPress/wordpress-develop/pull/10742.

Follow-up to [61415], [61485].

Props jonsurrell, westonruter.
Fixes #64511. See #64442.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-23 17:03:36 +00:00
fabiankaegy
1f11618eff Administration: Register wp-base-styles handle for admin color scheme variables.
Introduce the `wp-base-styles` stylesheet handle to provide admin color scheme CSS custom properties across WordPress. This stylesheet is added as a dependency for:
- The `wp-admin` styles bundle
- The block editor content iframe styles

This is the Core-side implementation of the changes from Gutenberg PRs #69128 and #69130, which consolidate the admin color scheme CSS custom properties into a single reusable stylesheet instead of duplicating them across multiple packages.

See #64308.
Props fabiankaegy, wildworks.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-23 13:50:36 +00:00
Weston Ruter
c20e7c2484 Docs: Remove duplicated @see PHPDoc tag.
Follow-up to [59823].

Props marian1, showravhasan, sabernhardt, mukesh27.
See #61965, #64224.
Fixes #64515.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-19 17:02:16 +00:00
youknowriad
c9624b69cf Build: Improve Gutenberg integration workflow.
This changeset improves the Gutenberg build integration to simplify the developer workflow and reinstore a flow similar to how package dependencies worked before the Gutenberg checkout-and-build approach was introduced.

Key improvements:
* Automatic rebuild on ref change: Adds a new `gutenberg:sync` script that stores a hash of the built ref in `.gutenberg-hash` and only rebuilds when the ref changes.
* Full integration on `npm install`: Running `npm install` now produces a fully working development environment with Gutenberg assets in `src/`.
* Clean Gutenberg checkout: Restores Gutenberg's `package.json` after the build completes.
* Stops copying `.js.map` files to `wp-includes/js/dist` since they reference non-existent paths.
* Remove package.json files from the build folder.
* Avoid closures and use prefixed functions.
* Updates build checks to use `jquery.js` instead of `edit-post.js` as the build indicator.

Props youknowriad, ellatrix, mcsf, dmsnell, ntsekouras, jorgefilipecosta, tobiasbg, peterwilsoncc.
Fixes #64393.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-19 17:00:30 +00:00
Felix Arntz
920844023c Administration: Add view transitions throughout WP Admin.
This changeset enables smooth transitions between the different admin screens. For the admin menu items, distinct view transition names are used to facilitate a simple visual slide effect when the active submenu changes between screens.

Props westonruter, mukesh27, joedolson.
Fixes #64470.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-19 16:58:45 +00:00
youknowriad
597c02e7bd Build/Test Tools: Add missing tools/webpack/development.js
Adds the missing `tools/webpack/development.js` file that was inadvertently
omitted from [61487].

See #64393.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-19 16:53:32 +00:00
jonsurrell
0f1223ce1f Script Loader: Use HTML API to generate SCRIPT tags.
Script tags have complicated and unintuitive parsing rules that make them difficult to author correctly. The HTML API automatically escapes script tag contents as necessary and will set attributes correctly. Using the HTML API to generate SCRIPT tags improves safety when working with SCRIPT tags, resolving a class of issues that have manifested repeatedly.

Changeset [61418] applied the HTML API to generate style tags in a similar way.

Developed in https://github.com/WordPress/wordpress-develop/pull/10639.

Props jonsurrell, dmsnell, westonruter.
Fixes #64500. See #64419, #40737, #62797, #63851, #51159.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-15 11:13:54 +00:00
youknowriad
2a51baab4b Customize: Preserve CSS cascade for Additional CSS in classic themes.
Restores the `$is_block_theme` check that was inadvertently removed in [61473]. This ensures that for classic themes, the Customizer's Additional CSS continues to be printed separately via `wp_custom_css_cb()` at priority 101 in `wp_head`, preserving its position at the end of the `<head>` for highest CSS specificity.

Follow-up to [61473].

Props westonruter.
Fixes #64408.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-13 18:05:49 +00:00
Weston Ruter
8895aa5a69 Code Modernization: Utilize spaceship operator <=> in sort comparison logic.
Some replaced instances also fix a bug where the comparison function should have returned `0` as opposed to `1` or `-1` as used in ternaries. This results in a performance improvement.

Developed in https://github.com/WordPress/wordpress-develop/pull/10717

Props soean, mukesh27, westonruter.
Fixes #64497.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-12 21:17:00 +00:00
youknowriad
5a7e06db91 Global Styles: Lift classic block restrictions.
Enable Global Styles functionality in classic WordPress themes, allowing features like the Font Library to work without requiring a theme.json file.

This change:
- Removes restrictions that prevented classic themes from accessing Global Styles features.
- Enables font functionality in classic themes through the Font Library.
- Fixes Fonts menu not appearing in classic themes by changing its submenu index to avoid collision with Widgets.

Props youknowriad, isabel_brison, ramonopoly.
Fixes #64408.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-12 12:20:59 +00:00
Weston Ruter
87bb5634ca Themes: Use WP_HTML_Tag_Processor to insert the block template skip link instead of JavaScript.
* The skip link now works when JavaScript is turned off.
* By removing the script, the amount of JavaScript sent to the client is reduced for a very marginal performance improvement.
* A new `wp-block-template-skip-link` stylesheet is registered, with minification and `path` data for inlining.
* The CSS for the skip link now has an RTL version generated, although it is not yet served when the styles are inlined. See #61625.
* The `wp_enqueue_block_template_skip_link()` function now exclusively enqueues the stylesheet since the script is removed.
* For backwards-compatibility, the skip link will continue to be omitted if `the_block_template_skip_link()` is unhooked from the `wp_footer` action or `wp_enqueue_block_template_skip_link()` is unhooked from `wp_enqueue_scripts`.

Developed in https://github.com/WordPress/wordpress-develop/pull/10676

Follow-up to [56932], [51003].

Props rutviksavsani, westonruter, dmsnell, whiteshadow01, Slieptsov.
See #59505, #53176.
Fixes #64361.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-11 06:36:49 +00:00
Weston Ruter
56076b1bc4 Code Modernization: Script Loader: Use null coalescing operator instead of isset() ternaries.
Developed as a subset of https://github.com/WordPress/wordpress-develop/pull/10654
Initially developed in https://github.com/WordPress/wordpress-develop/pull/4886

Follow-up to [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403].

Props costdev, westonruter.
See #58874, #63430.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-06 05:14:55 +00:00
jonsurrell
e160907f43 Scripts: Remove default attributes from tags.
`SCRIPT`, `STYLE`, and stylesheet `LINK` tags do not require a type attribute since the HTML5 standard was released in 2008. Removing the type attribute simplifies logic and normalizes the produced HTML content.

Developed in https://github.com/WordPress/wordpress-develop/pull/10664.

Follow-up to [61411], [46164].

Props jonsurrell, sabernhardt, westonruter.
Fixes #64428. See #59883, #64442.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-05 16:04:58 +00:00
youknowriad
f8aecf9607 Build: Update Gutenberg integration to checkout-and-build approach.
This changes WordPress Core's Gutenberg integration from npm packages to checking out and building Gutenberg directly. Instead of syncing individual npm packages, Core now checks out the Gutenberg repository, builds it, and copies the build artifacts.

This enables Core to use Gutenberg's advanced features like route-based navigation, full-page rendering, and the Font Library, while also streamlining future updates.

New commands:
  * `npm run gutenberg:checkout` - Clones Gutenberg at a specified ref
  * `npm run gutenberg:build` - Runs Gutenberg's build process
  * `npm run gutenberg:copy` - Copies and transforms build output to Core
  * `npm run gutenberg:integrate` - Runs all three steps

Main changes:
  * Removes webpack configs replaced by Gutenberg's build (blocks.js, packages.js, script-modules.js, development.js, vendors.js)
  * Adds Font Library page (`/wp-admin/font-library.php`)
  * Adds copy scripts to transform Gutenberg plugin paths to Core paths
  * Moves vendor copy step from webpack to Gruntfile

New year, new process. Happy New Year!

Props youknowriad, ellatrix, sirreal, westonruter, desrosj, tellthemachines.
Fixes #64393.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-05 12:16:10 +00:00
Weston Ruter
ca8b023f84 Script Loader: Add types for arrays in phpdoc.
This resolves 10 `missingType.iterableValue` issues in PHPStan.

Follow-up to [61402], [61362], [61358].

See #64224, #64238.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-03 07:38:33 +00:00
Weston Ruter
2938008651 Script Loader: Simplify data structure in wp_default_packages_vendor() to facilitate static analysis.
This resolves two PHPStan level 7 issues: `offsetAccess.notFound` and `argument.type`.

Follow-up to [44114].

See #64238, #45065.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-03 07:17:31 +00:00
jonsurrell
fe6a992df0 Use the HTML API to generate style tags.
The HTML API escapes `<style>` tag contents to ensure the correct HTML structure. Common HTML escaping is unsuitable for `<style>` tags because they contain "raw text." The additional safety allows other restrictions, such as rejecting content with `<>`, to be relaxed or removed because the resulting tag will be well-formed.

Developed in https://github.com/WordPress/wordpress-develop/pull/10656.

Props jonsurrell, westonruter, dmsnell, ramonopoly, soyebsalar01, drw158, sabernhardt.
See #64418.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-30 13:03:34 +00:00
Weston Ruter
2ab763418b Script Loader: Warn when a registered style has invalid path data and allow inlining empty stylesheets.
When a stylesheet is registered with a `path` that does not exist or which is not readable, then a `_doing_it_wrong()` is now issued. Previously, paths that did not exist were silently skipped; paths for empty styles were also needlessly skipped, since `wp_filesize()` also returns `0` for the failure case. 

Developed in https://github.com/WordPress/wordpress-develop/pull/10653

Follow-up to [50836].

Props westonruter, jonsurrell, soyebsalar01.
See #52620.
Fixes #64447.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-29 19:01:38 +00:00
jonsurrell
c900da708a Scripts: Remove non-HTML5 script support.
Remove the following behaviors that are obsolete in HTML5:

- CDATA wrappers around `SCRIPT` tag contents.
- Conversion of boolean attributes to strings (attribute `async="async"` becomes `async`).

HTML5 was released in 2008 and data suggests virtually all WordPress sites are served as HTML5. See #59883 for more details.

Developed in https://github.com/WordPress/wordpress-develop/pull/10660.

Props jonsurrell, westonruter, azaozz, soyebsalar01, dmsnell.
Fixes #64442. See #59883.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-29 11:34:29 +00:00
jonsurrell
7efd772694 Scripts: Remove CDATA script wrappers in WP Admin.
Fix a regression from [61411] where CDATA wrappers were added to `SCRIPT` tags in WP Admin.

Developed in https://github.com/WordPress/wordpress-develop/pull/10666.

Follow-up to [61411].

Props sabernhardt.
See #64428, #59883.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-29 10:49:33 +00:00
jonsurrell
5e1414562a Scripts: Remove default type attribute from tags.
`SCRIPT`, `STYLE`, and stylesheet `LINK` tags do not require a type attribute since the HTML5 standard was released in 2008. Removing the type attribute simplifies logic and normalizes the produced HTML content.

Developed in https://github.com/WordPress/wordpress-develop/pull/10658.

Follow-up to [46164].

Props hardikhuptechdev, jonsurrell, dmsnell, westonruter.
Fixes #64428. See #59883, #64442.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-26 13:16:34 +00:00
Sergey Biryukov
8ec8ae6eda Script Loader: Check if $_wp_admin_css_colors is set in wp_style_loader_src().
This aims to avoid PHP warnings if the `colors` dependency is loaded or the `style_loader_src` filter is used in a context where the `$_wp_admin_css_colors` global does not exist.

Follow-up to [7976].

Props crstauf, petitphp, SergeyBiryukov.
Fixes #61302.
Built from https://develop.svn.wordpress.org/trunk@61388


git-svn-id: http://core.svn.wordpress.org/trunk@60700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-16 23:38:34 +00:00
Weston Ruter
e4e4eeb291 Docs: Improve accuracy of wp_enqueue_classic_theme_styles() description.
Developed in https://github.com/WordPress/wordpress-develop/pull/10565

Follow-up to [59980], [54687], [54358].

Props manhphucofficial, wildworks, sabernhardt, iflairwebtechnologies, westonruter.
See #61892, #64224.
Fixes #64317.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-29 19:39:30 +00:00
wildworks
b6661d5528 Command Palette: Use HTML API for more reliable menu labels and URLs.
Replace regex-based HTML parsing with WP_HTML_Tag_Processor to properly extract text nodes from menu labels. This ensures only root-level text nodes are
collected.

Additionally, replace html_entity_decode() with WP_HTML_Decoder::decode_attribute() with the menu URL for consistent attribute decoding.

Follow-up to [61124], [61126], [61127], [61142].

Props: dmsnell, madhavishah01, peterwilsoncc, wildworks.
Fixes #64233.
Built from https://develop.svn.wordpress.org/trunk@61310


git-svn-id: http://core.svn.wordpress.org/trunk@60622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-26 04:28:39 +00:00
Weston Ruter
ede95a09bd Script Loader: Improve hoisted stylesheet ordering (in classic themes) to preserve CSS cascade.
This ensures that on-demand block styles are inserted right after the `wp-block-library` inline style whereas other stylesheets not related to blocks are appended to the end of the `HEAD`. This helps ensure the expected cascade is preserved. If no `wp-block-library` inline style is present, then all styles get appended to the `HEAD` regardless.

The handling of the CSS placeholder comment added to the `wp-block-library` inline style is also improved. It is now inserted later to ensure the inline style is printed. Additionally, when the CSS placeholder comment is removed from the `wp-block-library` inline style, the entire `STYLE` tag is now removed if there are no styles left (aside from the `sourceURL` comment).

Lastly, the use of the HTML Tag Processor is significantly improved to leverage `WP_HTML_Text_Replacement`.

Developed in https://github.com/WordPress/wordpress-develop/pull/10436

Follow-up to [61008].

Props westonruter, peterwilsoncc, dmsnell.
Fixes #64099.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-07 04:29:33 +00:00
cbravobernal
ca6c863c86 Command Palette: Revert Use HTLM_Tag_Processor to get the menu label when enqueueing assets.
Reverts [61126] and [61127], which introduced a bug where the command palette is not stripping numbers. `HTML_Tag_Processor` cannot replace the REGEX yet.

Unprops cbravobernal.

Follow-up to [61126], [61127].

Props wildworks, tusharaddweb.
See #64196.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-05 16:23:29 +00:00
davidbaumwald
7341300ff8 Command Palette: Ensure $menu_label is initialized before using it.
Unprops davidbaumwald.

Follow-up to [61126].

Props cbravobernal.
See #64196.
Built from https://develop.svn.wordpress.org/trunk@61127


git-svn-id: http://core.svn.wordpress.org/trunk@60463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-04 14:19:36 +00:00
davidbaumwald
16485b23ce Command Palette: Use HTML_Tag_Processor to get the menu label when enqueueing assets, not regex.
`HTML_Tag_Processor` is more better.

Follow-up to [61022].

Props dmsnell, cbravobernal.
Fixes #64196.
Built from https://develop.svn.wordpress.org/trunk@61126


git-svn-id: http://core.svn.wordpress.org/trunk@60462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-04 14:01:34 +00:00
wildworks
2d788f6ebd Command Palette: Decode HTML entities in menu url
Decode HTML entities in the menu URL so that query parameters, etc., will function as expected.

Follow-up to [61022].

Props swissspidy, tusharaddweb, youknowriad.
Fixes #64177.
Built from https://develop.svn.wordpress.org/trunk@61124


git-svn-id: http://core.svn.wordpress.org/trunk@60460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-04 09:39:31 +00:00
Weston Ruter
8534f6b1a8 Script Loader: Load block styles on demand in classic themes even when wp-block-styles support is absent.
This reverts part of [61076] which made `wp-block-styles` theme support a precondition for opting in to `should_load_separate_core_block_assets` and `should_load_block_assets_on_demand`. This meant that the Twenty Twenty theme (and other themes without this support declared) would not benefit from on-demand block style loading. Nevertheless, even though such themes were not getting block styles loaded on demand, the  `wp_load_classic_theme_block_styles_on_demand()` function was proceeding to opt in to the output buffer for hoisting late-printed styles, even though it was unlikely there would then be any. This meant the template enhancement output buffer was being opened for no reason.

Enabling on-demand block style loading is measured to improve FCP and LCP in Twenty Twenty, for example a ~13% improvement over a Fast 4G connection when loading the Sample Page.

Developed in https://github.com/WordPress/wordpress-develop/pull/10457

Follow-up to [61008], [61076], [60936].

Props westonruter.
See #64099, #64150, #64166, #43258.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-04 07:55:36 +00:00
wildworks
aaf46f5fa3 Command Palette: Add network admin check
To prevent the registration of commands that would cause a 404 error in the network admin screen, pass the result of the `is_network_admin()` check to the command palette initialization function.

Follow-up to [61022].

Props jorbin, ntsekouras, soean, tobiasbg
Fixes #64125.
Built from https://develop.svn.wordpress.org/trunk@61121


git-svn-id: http://core.svn.wordpress.org/trunk@60457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-04 07:05:31 +00:00
Weston Ruter
9f4eb0d284 Script Loader: Reduce styles_inline_size_limit down to 40K from 50K.
In [61013] the CSS inline limit was increased from 20K to 50K. However, based on benchmarking the performance improvements of increasing the limit, the relative improvement from 40K to 50K is not as great as from 30K to 40K. The performance improvements start to flatten out beginning at 40K. This 40K is still double the previous limit of 20K. Being more conservative will allow for a more gradual impact to be observed before considering a larger increase. Furthermore, the 50K limit of inline CSS can cause the oEmbed discovery links to be positioned after the first 150K bytes which prevents them from being discovered. See #64178.

Follow-up to [61013].

Props westonruter, mukesh27, szepeviktor.
See #64178.
Fixes #63018.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-03 21:57:33 +00:00
Weston Ruter
aa6d4d1a44 Script Loader: Fall back to hoisting late-printed styles to end of HEAD if wp-block-library is not enqueued.
When the `wp-block-library` stylesheet is not enqueued, there will be no associated inline style present. This inline style normally contains the placeholder CSS comment for the HTML Tag Processor to identify the token after which the late-printed styles should be inserted. However, when the `wp-block-library` stylesheet is not enqueued (such as in themes which do not use blocks), or else the inline style is not printed for whatever reason, this adds a fallback to insert the late-printed styles immediately before `</head>`. This ensures that late-printed styles will always get hoisted.  

Developed in https://github.com/WordPress/wordpress-develop/pull/10417

Follow-up to [61008].

Props westonruter, peterwilsoncc, Soean.
See #64099, #43258.
Fixes #64150.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-28 05:34:35 +00:00
Weston Ruter
ef01f4281c Script Loader: Fix logic inversion with $html5_script_support in wp_sanitize_script_attributes().
The value was actually whether HTML5 was ''not'' supported.

Follow-up to [50167].

Props jamieburchell, sabernhardt.
See #39941.
Fixes #64128.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-22 22:33:32 +00:00
cbravobernal
00a7c0d3d9 Command Palette: Enqueue command-related assets for all admin pages.
Removes the core command initialization and registration code from the edit-post and edit-site packages and enqueues command-related assets globally.

Props wildworks, rcorrales, shailu25, youknowriad.

Fixes #63845.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-21 12:34:30 +00:00
Weston Ruter
a27d227c9d Script Loader: Increase styles_inline_size_limit from 20K to 50K.
Benchmarking of initial page loads versus repeat page loads shows there is a greater performance improvement to increase inlining versus the benefits of relying on browser cache.

This new limit is expected to be further refined during beta based on additional testing.

Props westonruter, sabernhardt, poena, aristath, spacedmonkey, adamsilverstein, jonoaldersonwp, peterwilsoncc.
See #63007.
Fixes #63018.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-21 08:47:27 +00:00
Weston Ruter
8e6fdc7c1d Script Loader: Load block styles on demand in classic themes via the template enhancement output buffer.
* This applies in classic themes when a site has not opted out of the template enhancement buffer by filtering `wp_should_output_buffer_template_for_enhancement` off.
* Both `should_load_separate_core_block_assets` and `should_load_block_assets_on_demand` are filtered on, as otherwise they are only enabled by default in block themes.
* Any style enqueued after `wp_head` and printed via `print_late_styles()` will get hoisted up to be inserted right after the `wp-block-library` inline style in the `HEAD`.
* The result is a >10% benchmarked improvement in LCP for core classic themes due to a ~100KB reduction in the amount of CSS unconditionally being served with every page load.

Developed in https://github.com/WordPress/wordpress-develop/pull/10288

Follow-up to [60936].

Props sjapaget, westonruter, peterwilsoncc, dmsnell, mindctrl.
See #43258.
Fixes #64099.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-21 06:01:35 +00:00
dmsnell
2995f8d0e3 JS Interop: Add custom data attribute name converter pair.
This patch introduces two new functions: `wp_js_dataset_name()` and `wp_html_custom_data_attribute_name()`. Together, these provide reliable mapping between the HTML attribute names for custom data attributes, and the properties found in JavaScript for a given `HTMLElement`’s `.dataset` property.

These are to be used where matching names is important, such as in the Interactivity API and when WordPress is deciding whether or not to allow an attribute as a custom data attribute.

Developed in https://github.com/WordPress/wordpress-develop/pull/9953
Discussed in https://core.trac.wordpress.org/ticket/61501

Props dmsnell, westonruter.

See #61501.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-21 05:12:32 +00:00
joedolson
83f64ea185 General: Remove support for IE conditional comments.
Remove the ability to enqueue scripts and styles wrapped in IE conditional comment tags. Conditional comment support was removed from IE in version 10 in 2012, and no core supported browser renders them in any way. IE9 has global usage approaching zero. WordPress dropped support for IE10 and below in version 4.8.

Patch adds a deprecation notice if the conditional data argument is added. Scripts and styles are not printed, and neither are their dependencies if they are not required by other non-conditional scripts. Conditional dependencies are removed from core enqueues. 

Props jonsurrell, joedolson, shailu25, siliconforks, dmsnell, sabernhardt, rollybueno.
Fixes #63821.
Built from https://develop.svn.wordpress.org/trunk@60948


git-svn-id: http://core.svn.wordpress.org/trunk@60284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-16 20:01:36 +00:00
Weston Ruter
3e1e720c6a Script Loader: Use original stylesheet URL for sourceURL when inlined.
For inline styles which had been inlined from registered external stylesheets via `wp_maybe_inline_styles()`, this defers to using the original stylesheet URL for the `sourceURL` as opposed to fabricating one from the stylesheet handle. This makes the `sourceURL` much more useful for debugging, as it indicates where the stylesheet is located. This allows a developer to make a change to the CSS more easily.

Developed in https://github.com/WordPress/wordpress-develop/pull/10177.

Follow-up to [50836].

Props westonruter, mukesh27, gziolo.
See #50328, #52620.
Fixes #63887.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-10 04:19:32 +00:00