Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#12248 closed defect (bug) (fixed)

get_generic_template action should pass both slug and name as parameters

Reported by: ptahdunbar Owned by:
Priority: normal Milestone: 3.0
Component: Template Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

get_generic_template() has a do_action call that gets fired when it's used.
do_action( "get_generic_template_{$slug}", $name );

I propose to change it into this:
do_action( 'get_generic_template', $slug, $name );

So other themes and plugins can easily hook into the 'get_generic_template' and run code without initially having to know the slug.

Attachments (1)

get_generic_template_patch.diff​ (757 bytes ) - added by ptahdunbar 17 years ago.

Download all attachments as: .zip

Change History (5)

#1 @hakre
17 years ago

Related: #12105

#2 follow-up: @westi
17 years ago

I am strongly against having an action in this function which gets called whatever the $slug.

I am quite happy to add the $slug as one of the arguments probably after the name so if people want to hook the same function on twice they can.

We shouldn't encourage people to hook into a really generic action here to do things they should be hooking in for specific situations where they need to do something.

Otherwise we end up calling a lot of code unnecessarily.

#3 in reply to: ↑ 2 @ptahdunbar
17 years ago

Replying to westi:

I am strongly against having an action in this function which gets called whatever the $slug.
...
We shouldn't encourage people to hook into a really generic action here to do things they should be hooking in for specific situations where they need to do something.

Otherwise we end up calling a lot of code unnecessarily.

Ok, that's a compromise. However, there _needs_ to be a filter. Related: #11242

#4 @nacin
17 years ago

  • Resolution → fixed
  • Status new → closed

(In [14047]) Tweaks to the action in get_template_part(). fixes #12248, fixes #12941.

Note: See TracTickets for help on using tickets.