[wp-trac] [WordPress Trac] #11242: Add "template_include" action to be run just before templates are included

WordPress Trac wp-trac at lists.automattic.com
Tue Nov 24 17:43:59 UTC 2009


#11242: Add "template_include" action to be run just before templates are included
-----------------------------+----------------------------------------------
 Reporter:  holizz           |        Owner:  westi   
     Type:  enhancement      |       Status:  reopened
 Priority:  normal           |    Milestone:          
Component:  Plugins          |      Version:          
 Severity:  normal           |   Resolution:          
 Keywords:  has-patch close  |  
-----------------------------+----------------------------------------------

Comment(by nacin):

 A filter is a type of hook. (An action, such as template_redirect, is
 another type.)

 Every $template is run through a filter before being included.
 get_attachment_template uses get_query_template, which in turn invokes a
 filter. Having a filter to run through $template in template-loader.php
 would not allow for any context, hence why it's best to use the individual
 filters or utilize template_redirect, or utilize a combination of both.

 The various *_template filters include category_template,
 comments_popup_template,
 comments_template, home_template, page_template, tag_template,
 taxonomy_template, {$type}_template. You could tie the same function to
 all of them if you'd like.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11242#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list