[wp-trac] [WordPress Trac] #51691: Call get_template_directory() once instead of multiple times for loading theme's files (performance boost)
WordPress Trac
noreply at wordpress.org
Sun Nov 1 23:25:03 UTC 2020
#51691: Call get_template_directory() once instead of multiple times for loading
theme's files (performance boost)
----------------------------+------------------------------
Reporter: hellofromTonya | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Bundled Theme | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses: performance
----------------------------+------------------------------
Comment (by apedog):
There's an assumption here - that {{{get_template_directory()}}} should
return the same value every time it's called by the theme. If so, the
result can be memoized and re-used. That's a big assumption for a default
theme that's meant to be extended in a child-theme by users.
12 calls to 5 hooks that might not all be filtered, and if filtered, will
likely involve a simple string replacement, is not a lot of performance.''
- I think.''
Adding this "cached" result is actually a restriction for the user
extending the theme.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51691#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list