[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
Mon Nov 2 01:41:40 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 hellofromTonya):

 Replying to [comment:8 apedog]:
 > Yeah. Filters are often conditional.
 > The design is to ''allow'' a user to short-circuit/override the default
 output in a filter. Either wholesale (whenever the hook is called) or only
 when a certain condition is met.

 So you're saying, that yes, the theme is intentionally designed to allow
 each file to be loaded from different directory source? More concretely
 from the code shared above, the design allows each of the 8 different
 files to be loaded from 8 different directory sources.

 If yes, that seems hard to control through a callback. Why? How would the
 callback know with certainty which file belongs to the
 `get_template_directory()` being called?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51691#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list