Opened 10 years ago
Closed 9 years ago
#39407 closed defect (bug) (fixed)
Twenty Fourteen fatals in WordPress < 4.0.0
| Reported by: | n247s | Owned by: | davidakennedy |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.8 |
| Component: | Bundled Theme | Version: | 4.5 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
After updating theme "twentyfourteen" to the newest version (Stable tag: 1.9) I got an "internal Server error (code=500)", not only when accesing the site itself, but also when trying to acces the admin-tool.
I enable logging and found a single line printed in the logs:
[27-Dec-2016 15:31:05 UTC] PHP Fatal error: Call to undefined function is_customize_preview() in /mnt/web016/d2/13/52084413/htdocs/WordPress_01/wp-content/themes/twentyfourteen/inc/widgets.php on line 40
I tried to manually update the Theme via FTP acces resulting in the same error.
I hope this is enough information, if you need more feel free to ask.
Attachments (1)
Change History (9)
#2
@
10 years ago
In 39407.diff:
Themes: In Twenty Fourteen, add an is_customize_preview function if it is missing.
#3
@
10 years ago
- Summary Couldn't call method 'is_customize_preview()' in Widget.php → Twenty Fourteen fatals in WordPress < 4.0.0
This ticket was mentioned in Slack in #core-themes by adamsilverstein. View the logs.
9 years ago
This ticket was mentioned in Slack in #core-themes by davidakennedy. View the logs.
9 years ago
#7
@
9 years ago
Thanks @n247s for the report! Great catch, and welcome to Trac.
Thanks @adamsilverstein for the debugging and patch. It works well, and as we discussed in Slack, this seems like the best and cleanest solution. In a perfect world, we wouldn't have rolled in these changes to Twenty Fourteen had it been caught in testing. But this seems like the best direction.
I tested on a few versions below 4.0 and the patch works as expected.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
@n247s Thanks for the bug report. What version of WordPress are you running?
The line of code throwing the error was introduced in WordPress 4.5 in [37040] "Customize: Require opt-in for selective refresh of widgets.". Since
is_customize_preview()was introduced in 4.0.0 and Twenty Fourteen should work from WordPress 3.6 and up, this is a problem. Introducing a shim for this function directly in the theme is probably a safe fix.