[wp-trac] [WordPress Trac] #64544: Core GB backport - individual block custom CSS
WordPress Trac
noreply at wordpress.org
Tue May 19 09:05:41 UTC 2026
#64544: Core GB backport - individual block custom CSS
-------------------------------------------------+-------------------------
Reporter: glendaviesnz | Owner: ellatrix
Type: enhancement | Status: reopened
Priority: normal | Milestone: 7.0
Component: General | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch gutenberg-merge fixed- | Focuses:
major dev-reviewed |
-------------------------------------------------+-------------------------
Comment (by ellatrix):
In [changeset:"62376" 62376]:
{{{
#!CommitTicketReference repository="" revision="62376"
Block Supports: Improve performance and hardening of block-level custom
CSS rendering.
Short-circuits the custom CSS support filter before the more expensive
lookups so blocks without custom CSS return faster.
Replaces the regex class name parsing in
`wp_render_custom_css_class_name()` with a cheap `str_contains()` guard
followed by an HTML spec-compliant `strtok()` walk over the className
tokens. This avoids the regex engine for the common case where no `wp-
custom-css-` class is present, and correctly handles tab/form-feed/CR/LF
separators as well as classes such as `my-wp-custom-css-*` that merely
contain the prefix as a substring after a hyphen.
Also hardens both functions against malformed parsed blocks (non-string
`className`, missing keys), tightens `@phpstan-param` array shapes, and
corrects the `block_has_support()` `@param` to allow `WP_Block_Type|null`.
Lastly, a `@return Generator<int, non-empty-string>` phpdoc tag is added
to `WP_HTML_Tag_Processor::class_list()`.
Developed in https://github.com/WordPress/wordpress-develop/pull/11686 and
https://github.com/WordPress/gutenberg/pull/78217
Follow-up to r61678.
Reviewed by ellatrix.
Merges [62359] to the 7.0 branch.
Props mukesh27, westonruter, ramonopoly, jonsurrell.
See #64544, #64238.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64544#comment:31>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list