[wp-trac] [WordPress Trac] #58384: locate_template calls file_exists a lot
WordPress Trac
noreply at wordpress.org
Tue May 23 14:49:44 UTC 2023
#58384: locate_template calls file_exists a lot
--------------------------+----------------------------
Reporter: spacedmonkey | Owner: (none)
Type: enhancement | Status: new
Priority: high | Milestone: Future Release
Component: Themes | Version: 4.7
Severity: normal | Keywords:
Focuses: performance |
--------------------------+----------------------------
The function `locate_template` calls `file_exists` three times for every
each template name. As locate_template can be called multiple times on a
page request for both classic and block themes, this can result in poor
performance for this function.
As `file_exists` can be an expensive function to run, as the file lookup
on file system can be slow, some level of caching should be added to this
function.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58384>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list