Make WordPress Core

Opened 14 years ago

Closed 4 months ago

Last modified 4 months ago

#12491 closed enhancement (wontfix)

add a pre_template_include filter, so as to allow caching of the template file

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Themes Keywords:
Focuses: performance, template Cc:


rather than running file exists all over the place in the template loader, we should offer the possibility for a plugin to cache the information for use in subsequent pages.

Attachments (1)

12491.diff (784 bytes) - added by Denis-de-Bernardy 14 years ago.

Download all attachments as: .zip

Change History (13)

#1 @nacin
14 years ago

Patch looks fine, though I'm wondering why you didn't place it above 404 as well, just cause.

More so, couldn't you write to cache on the template_include hook and pull from cache on template_redirect?

Seems like a worksforme, considering that the two hooks now seem more than flexible enough for what you're going for.

#2 @Denis-de-Bernardy
14 years ago

re 404, the point would be to write a plugin that looks up the available template files, caches that accordingly, and knows, based on what the WP Query tells it, what file to use without needing to do a file_exists() call.

template_redirect works fine too for this, up to a point:

  • it would mean the plugin needs to handle robots, feeds, etc. it would also mean the plugin would need to manage whatever we add in there in the future.
  • it would re-introduce the inflexibility that led us to introduce the 2nd hook in the first place, i.e. the plugin itself would not be plugin-able.

#3 @hakre
14 years ago

Additionally, and that is not that visible in the trac patch browser, pre_template_include is building a good pair to template_include, a principle that you can find more and more often within the codebase.

#4 @nacin
14 years ago

Apparently I had misread the diff, and thought 404 was processed before the filter. Obviously, filter comes first in the diff.

#5 @nacin
14 years ago

  • Milestone changed from 3.0 to 3.1

#6 @nacin
14 years ago

  • Milestone changed from Awaiting Triage to Future Release

#7 @nacin
10 years ago

  • Component changed from Optimization to Template
  • Focuses performance added

#8 @nacin
10 years ago

  • Component changed from Template to Themes
  • Focuses template added

#9 @chriscct7
9 years ago

  • Keywords dev-feedback added

#10 @mukesh27
2 years ago

  • Keywords needs-refresh added

#11 @pbearne
4 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

the template loader code has been refactored so that this filter no longer makes sense

Closing as won't fix

#12 @pbearne
4 months ago

  • Keywords has-patch dev-feedback needs-refresh removed
Note: See TracTickets for help on using tickets.