[wp-trac] [WordPress Trac] #58528: Performance issue in register_block_style_handle
WordPress Trac
noreply at wordpress.org
Mon Jun 26 21:15:36 UTC 2023
#58528: Performance issue in register_block_style_handle
--------------------------+---------------------------
Reporter: spacedmonkey | Owner: spacedmonkey
Type: defect (bug) | Status: closed
Priority: high | Milestone: 6.3
Component: Editor | Version: 5.8
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses: performance
--------------------------+---------------------------
Changes (by spacedmonkey):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"56044" 56044]:
{{{
#!CommitTicketReference repository="" revision="56044"
Editor: Register core block styles in one place.
Register all core blocks in a new function called
`register_core_block_style_handles`. This mirrors the function
`wp_default_styles` where all core styles are registered in one place.
This improves block registration performance, as it avoids expensive file
lookups, like realpath in `register_block_style_handle`. The new function
`register_core_block_style_handles` uses `glob` to get all css files in
the blocks directory. This glob is cached in a transient to save lookups
on subsequent requests. The function `register_block_style_handle` now
checks to see if the style handle is already registered before trying to
register it again.
Props mukesh27, westonruter, flixos90, joemcgill, spacedmonkey.
Fixes #58528.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58528#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list