[wp-trac] [WordPress Trac] #54541: Add actions to template loading to assist with collecting debug info
WordPress Trac
noreply at wordpress.org
Tue Nov 30 14:25:31 UTC 2021
#54541: Add actions to template loading to assist with collecting debug info
--------------------------+-----------------------------
Reporter: rmccue | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version:
Severity: normal | Keywords: needs-patch
Focuses: performance |
--------------------------+-----------------------------
`locate_template()` is the low-level workhorse that handles finding
template parts; with the second parameter (`$load = true`), it also
handles actually loading those templates. This is used throughout the
template hierarchy loading system; `get_template_part()` calls it, as well
as `get_header()`, `get_footer()`, etc.
In order to provide timing data to debug tools like Query Monitor, having
actions before and after the template itself loads would be super useful.
We could do this within each usage of `locate_template()`, or inside it.
Potentially, this could be a shortcircuit filter, allowing for alternative
loading patterns (#13239) or automatic fragment caching. **However** I
don't want to derail this ticket, as there are a lot of strong opinions on
the template hierarchy, so I would suggest we do **not** provide a filter
at this stage; right now, just having the timing data would be useful.
(I offer no opinions at this time on the relation to the Gutenberg FSE
templating.)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54541>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list