Skip to content

Commit

Permalink
Themes: Change the order of path check in is_block_theme method.
Browse files Browse the repository at this point in the history
Change check to see if the current theme is a block theme, to check the path `/templates/index.html` first over the deprecated path `/block-templates/index.html`. 
As this path was deprecated in WP 5.9, it is more likely the block theme would use the current path. This saves a file_exists call which improves performance. 

Props nihar007, spacedmonkey.
Fixes #58520.

git-svn-id: https://develop.svn.wordpress.org/trunk@55941 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
spacedmonkey committed Jun 19, 2023
1 parent b2cb29a commit a14bc9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-theme.php
Expand Up @@ -1515,8 +1515,8 @@ public function is_block_theme() {
}

$paths_to_index_block_template = array(
$this->get_file_path( '/block-templates/index.html' ),
$this->get_file_path( '/templates/index.html' ),
$this->get_file_path( '/block-templates/index.html' ),
);

$this->block_theme = false;
Expand Down

0 comments on commit a14bc9b

Please sign in to comment.