Opened 12 years ago
Closed 9 years ago
#22401 closed enhancement (fixed)
Add information about old theme to 'theme_switched' action
Reported by: | evansolomon | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | 3.3 |
Component: | Themes | Keywords: | has-patch |
Focuses: | Cc: |
Description
Currently the 'theme_switch' action passes data about the theme you're switching to, but not the theme you're switching from. Adding it there would make it easier to juggle functionality that needs to know about new and old themes. Right now some of this happens by setting an option ('theme_switched') and checking for it on init, then deleting the option. That could be simplified by just passing the old theme's data in theme_switched.
There's an added benefit that we avoid checking for an option on every single request that usually won't be there.
Attachments (3)
Change History (19)
#3
@
11 years ago
- Keywords has-patch added; needs-patch removed
Fixes check_theme_switched() function indentation.
#6
@
9 years ago
I anticipate back compat issue if we moved after_switch_theme
to the same page load as switch_theme
since we're changing the context in which the action is fired. Default themes checking for the required WP version couldn't self deactivate anymore for example.
No objections to adding old theme info to switch_theme
though.
#7
@
9 years ago
+1 Adding the old theme info would be helpful. An example use case is logging when people switch themes on a multisite environment — seeing patterns from old to new.
#11
@
9 years ago
- Keywords needs-docs added
22401.diff needs a changelog entry for the new parameter.
#14
@
9 years ago
- Owner changed from obenland to DrewAPicture
- Status changed from accepted to assigned
Looking at the patch, it looks like
check_theme_switched()
needs to be reindented?