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)
Change History (5)
#2
follow-up:
↓ 3
@
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
@
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
Related: #12105