Opened 12 years ago
Closed 12 years ago
#24441 closed defect (bug) (fixed)
Twenty Thirteen switch theme back compat missing argument
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | 3.3 |
Component: | Bundled Theme | Keywords: | |
Focuses: | Cc: |
Description
Try activating Twenty Thirteen on a pre-3.4 install. It returns (on 3.3.2) a missing argument 2 for twentythirteen_switch_theme()
error, because the pre-3.4 after_switch_theme
action uses only 1 param ($old_theme
).
I know, i'm not using the latest install of WP, but since inc/back-compat.php is breaking WP while the file header states explicitly: Prevents Twenty Thirteen from running on WordPress versions prior to 3.6
, i'm guessing we need a fix.
Attachments (4)
Change History (15)
#2
follow-up:
↓ 4
@
12 years ago
- Milestone changed from Awaiting Review to 3.6
This is in the back compat code that deactivates itself < 3.6, so I don't think it is too much to make sure it works pre-3.4.
It could do twentythirteen_switch_theme( $theme_name, $theme = null )
and then just switch to WP_DEFAULT_THEME if $theme is null. But I don't think twentythirteen_switch_theme() actually needs to check $theme at all. It can probably just switch_theme() to WP_DEFAULT_THEME. It's trying to be too clever — when would this code ever run when twentythirteen isn't the active theme?
#3
@
12 years ago
A note, switch_theme() must be called with two arguments — switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ) — to be compatible with pre-3.4.
It won't work if WP_DEFAULT_THEME is a child theme, but core *should* pick up on that, declare the default child theme to be broken, and finally revert to the real default theme. At worst, the front of the site is a white screen (and the admin works fine), but that's better than a fatal error.
#4
in reply to:
↑ 2
;
follow-up:
↓ 5
@
12 years ago
Replying to nacin:
It's trying to be too clever — when would this code ever run when twentythirteen isn't the active theme?
Agreed, let's simplify.
Replying to nacin:
It won't work if WP_DEFAULT_THEME is a child theme, but core *should* pick up on that, declare the default child theme to be broken, and finally revert to the real default theme. At worst, the front of the site is a white screen (and the admin works fine), but that's better than a fatal error.
Do you mean if it's a child theme of Twenty Thirteen?
In my (short) tests the child theme (Hum => Twenty Eleven) worked just fine, I did not test it with a Twenty Thirteen child. When defining a non-existing theme, the front of the site is indeed white but the admin still works.
#5
in reply to:
↑ 4
@
12 years ago
Replying to obenland:
Do you mean if it's a child theme of Twenty Thirteen?
Nope. The check if ( 'twentythirteen' != $theme->get_template() )
would imply that Twenty Thirteen could also be a child theme, given that this code is only run when Twenty Thirteen is activated.
#6
@
12 years ago
Patches look good and test out in 3.3, 3.4, and 3.5.
For 3.3 and earlier, we could also handle the Preview functionality -- with this current patch it does not die or exit.
#8
@
12 years ago
After discussing with Obenland and Nacin in #wordpress-dev today, I'd like to take a closer look at this.
Can we remove this compat file completely? After the post format functionality removal, Twenty Thirteen should be pretty close to error-free in older installs now.
#9
@
12 years ago
In 3.4, Link and Gallery posts fatal with undefined functions and we'd need to style the old searchform and comments output.
Hmm. I think we agreed on going back to 3.4 (two major versions).