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

WordPress Trac noreply at wordpress.org
Fri Nov 11 16:25:02 UTC 2022


#57057: Reduce usage of `wp_get_theme`
----------------------------------------------+---------------------------
 Reporter:  spacedmonkey                      |       Owner:  spacedmonkey
     Type:  task (blessed)                    |      Status:  closed
 Priority:  normal                            |   Milestone:  6.1.1
Component:  Themes                            |     Version:  6.1
 Severity:  normal                            |  Resolution:  fixed
 Keywords:  has-patch has-screenshots commit  |     Focuses:  performance
----------------------------------------------+---------------------------
Changes (by spacedmonkey):

 * owner:  (none) => spacedmonkey
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54817" 54817]:
 {{{
 #!CommitTicketReference repository="" revision="54817"
 Themes: Reduce usage of `wp_get_theme` function.

 Calling the `wp_get_theme` function creates a instance of the `WP_Theme`
 class. This can be a performance issue, if all you need is one property of
 the class instance. This change replaces the usage of
 `wp_get_theme()->get_stylesheet()` with `get_stylesheet()` to improve
 performance.

 Props spacedmonkey, flixos90, peterwilsoncc, desrosj.
 Fixes #57057.
 }}}

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


More information about the wp-trac mailing list