[wp-trac] [WordPress Trac] #59279: Unnecessarily check to see site is using a child theme in the theme functions.

WordPress Trac noreply at wordpress.org
Wed Sep 6 12:59:04 UTC 2023


#59279: Unnecessarily check to see site is using a child theme in the theme
functions.
--------------------------+---------------------------
 Reporter:  spacedmonkey  |       Owner:  spacedmonkey
     Type:  enhancement   |      Status:  closed
 Priority:  normal        |   Milestone:  6.4
Component:  Themes        |     Version:  4.7
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+---------------------------
Changes (by spacedmonkey):

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


Comment:

 In [changeset:"56523" 56523]:
 {{{
 #!CommitTicketReference repository="" revision="56523"
 Themes: Remove unnecessary check if file exists in the theme functions.

 Previously, several functions and methods in themes api were designed to
 check for the existence of files in a child theme before falling back to
 the parent theme. However, these checks did not consider whether the
 current theme was a child theme or not, resulting in unnecessary file
 existence checks for non-child themes. Check to see if stylesheet
 directory matches the template directory before doing the file exists.
 This optimization helps reduce unnecessary file system access, as file
 existence checks can be resource-intensive in PHP.

 The following functions and methods have been updated as part of this
 enhancement:
 - `WP_Theme::get_file_path`
 - `get_theme_file_path`
 - `get_theme_file_uri`

 Props spacedmonkey, flixos90, sabernhardt, 10upsimon, mukesh27.
 Fixes #59279.
 }}}

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


More information about the wp-trac mailing list