mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Themes: Avoid unnecessary check whether parent template file exists when not using a child theme.
Prior to this change, the `locate_template()` function would unconditionally check whether the relevant template file exists in the parent theme, which for sites not using a child theme is an exact duplicate of the previous check. This is wasteful and has a small impact on performance since `file_exists()` checks have a cost. Props nihar007, thekt12, spacedmonkey, mukesh27. Fixes #58576. git-svn-id: https://develop.svn.wordpress.org/trunk@56357 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -707,7 +707,7 @@ function locate_template( $template_names, $load = false, $load_once = true, $ar
|
||||
if ( file_exists( STYLESHEETPATH . '/' . $template_name ) ) {
|
||||
$located = STYLESHEETPATH . '/' . $template_name;
|
||||
break;
|
||||
} elseif ( file_exists( TEMPLATEPATH . '/' . $template_name ) ) {
|
||||
} elseif ( is_child_theme() && file_exists( TEMPLATEPATH . '/' . $template_name ) ) {
|
||||
$located = TEMPLATEPATH . '/' . $template_name;
|
||||
break;
|
||||
} elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) {
|
||||
|
||||
Reference in New Issue
Block a user