[wp-trac] [WordPress Trac] #57057: Reduce usage of `wp_get_theme`

WordPress Trac noreply at wordpress.org
Thu Nov 10 16:55:10 UTC 2022


#57057: Reduce usage of `wp_get_theme`
---------------------------------------+--------------------------
 Reporter:  spacedmonkey               |       Owner:  (none)
     Type:  enhancement                |      Status:  new
 Priority:  normal                     |   Milestone:  6.1.2
Component:  Themes                     |     Version:  6.1
 Severity:  normal                     |  Resolution:
 Keywords:  has-patch has-screenshots  |     Focuses:  performance
---------------------------------------+--------------------------

Comment (by desrosj):

 @spacedmonkey It looks like [https://github.com/WordPress/wordpress-
 develop/actions/runs/3436903627/jobs/5730981300 one of the changes needs
 to be submitted upstream to Gutenberg].

 There are definitely some instances where removing `wp_get_theme()` may be
 appropriate, and this seems like a great improvement at the surface. But I
 wonder if there's a better way since this does not address the root
 problem that creating instances of `WP_Theme` can be resource intensive.
 But what about reworking `WP_Theme` to have a `get_instance()` method
 that's called by `wp_get_theme()` (similar to what is done for posts,
 terms, comments, etc.) and using the Cache API?

 This also feels like a major release change rather than a minor one to me.
 I'm going to leave it in 6.1.2 for now and will let the folks leading that
 release make the final call, but I recommend waiting for 6.2 for including
 this.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57057#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list