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

WordPress Trac noreply at wordpress.org
Fri Nov 11 16:29:42 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:
  fixed-major                                    |  performance
-------------------------------------------------+-------------------------
Changes (by desrosj):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54818" 54818]:
 {{{
 #!CommitTicketReference repository="" revision="54818"
 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.
 Merges [54817] to the 6.1 branch.
 Fixes #57057.
 }}}

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


More information about the wp-trac mailing list