Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#58520 closed enhancement (fixed)

Change the order of check in is_block_theme

Reported by: spacedmonkey Owned by: spacedmonkey
Priority: normal Milestone: 6.3
Component: Themes Version: 5.8
Severity: normal Keywords: good-first-bug commit
Cc: Focuses: performance

Description

In the method is_block_theme in WP_Theme class, a check for files in block-templates and templates. However files in block-templates where deprecated in 5.9. It is far more like that themes will have files in the templates directory. To improve performance, change the order of the lookup, to check block-templates and save a file lookup.

Attachments (1)

58520-1.diff (531 bytes ) - added by nihar007 3 years ago.
Patch added

Download all attachments as: .zip

Change History (3)

@nihar007
3 years ago

Patch added

#1 @spacedmonkey
3 years ago

  • Keywords commit added
  • Milestone Future Release6.3

#2 @spacedmonkey
3 years ago

  • Owner set to spacedmonkey
  • Resolutionfixed
  • Status newclosed

In 55941:

Themes: Change the order of path check in is_block_theme method.

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.

Note: See TracTickets for help on using tickets.