[wp-trac] [WordPress Trac] #55780: Global Styles: Introduce filter for toggling stylesheet cache

WordPress Trac noreply at wordpress.org
Thu May 19 15:03:45 UTC 2022

#55780: Global Styles: Introduce filter for toggling stylesheet cache
 Reporter:  tyxla                   |      Owner:  (none)
     Type:  defect (bug)            |     Status:  new
 Priority:  normal                  |  Milestone:  Awaiting Review
Component:  Editor                  |    Version:  trunk
 Severity:  normal                  |   Keywords:
  Focuses:  multisite, performance  |
 Currently, for `wp_get_global_stylesheet()` and
 `wp_get_global_styles_svg_filters()` we'll cache the merged stylesheet
 data per theme in a transient for a minute if:

 * `WP_DEBUG` is not enabled;
 * `SCRIPT_DEBUG` is not enabled;
 * This is not a REST API request
 * We're not in the admin

 However, for huge multisite instances that leverage object caching, this
 can result in thousands of `wp_cache_set()` operations per minute, which
 can be quite intensive.

 At the same time, retrieving the global stylesheet data and merging it, on
 a well-optimized server will usually take very little time (up to a few

 As a consequence, we end up wanting to disable that caching, because it
 creates more problems than it solves. However, there is no good trigger
 for disabling just that cache.

 I'd like to propose a filter that allows us to disable the global
 stylesheet cache. While it will still be enabled by default, disabling it
 will be easy when needed.

Ticket URL: <https://core.trac.wordpress.org/ticket/55780>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list