[wp-trac] [WordPress Trac] #13239: Filter locate_template template_names variable

WordPress Trac noreply at wordpress.org
Thu Jul 23 18:40:58 UTC 2015


#13239: Filter locate_template template_names variable
-------------------------+-----------------------------
 Reporter:  chrisjean    |       Owner:
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  Future Release
Component:  Themes       |     Version:  3.0
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+-----------------------------

Comment (by aristath):

 Replying to [comment:88 coreyw]:
 > Thank you @aristath, but that patch is almost worthless without
 $template_names being passed to the filter.

 Jeez... I don't know what I was thinking, you're absolutely right!
 Added in
 https://core.trac.wordpress.org/attachment/ticket/13239/13239.template.php.2.diff

 > In fact it might even be better to put it in the foreach loop, so that
 you can check each template name passed to see if it exists somewhere
 other than the default locations.
 The `break` inside the conditionals there would prevent the filter from
 being processed if I added it after those, so this is an alternative
 suggestion:
 https://core.trac.wordpress.org/attachment/ticket/13239/13239.template.php.3.diff

 In there I removed the `break` from the conditionals and afterwards I'm
 checking if `( '' != $located )`.
 If that's true, the filter is applied and after that it breaks the
 `foreach`.

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


More information about the wp-trac mailing list