#34167 closed enhancement (fixed)
Shortcode_atts pass $shortcode
| Reported by: | mattheu | Owned by: | helen |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.4 |
| Component: | General | Version: | 4.4 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
It would be useful to pass the Shortcode name as the 4th param to the filter shortcode_atts_{$shortcode}
Use case - I am wanting to add a filter for a number of shortcodes - so I loop through the and add the filter. However this means that I don't know the exact shortcode context in the callback.
Workaround - I am currently working around this by using a closure and use to import the $shortcode variable into the closure. However this is not PHP 5.2 compatable.
Attachments (2)
Change History (9)
#2
@
11 years ago
- Milestone Awaiting Review → 4.4
Just for reference, since I wondered this as I read the ticket: in #15155 it appears that @nacin suggested not having the generic `shortcode_atts` filter.
#3
@
11 years ago
Oh good call on using current_filter to achieve this. I'd be happy enough with this solution.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Just FYI, another option in a case like this is to use the
current_filter()function to determine the value of the dynamic portion of the hook. Your patch would be even better, of course. :-)