Opened 17 months ago
Closed 12 months ago
#19743 closed defect (bug) (fixed)
Trim code from Twenty Eleven theme-options
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | high | Milestone: | 3.4 |
| Component: | Bundled Theme | Version: | 3.3.1 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Otto42 |
Description
Suggest removal of the conditional statement for add_option() in twentyeleven_theme_options_init()
The function twentyeleven_get_theme_options() uses get_option() and sets the $default parameter.
The conditional statement will never evaluate twentyeleven_get_theme_options() as false. This is probably an artifact from a previous release. As far as I can tell, removing it has no effect to the current revision except for trimming code.
Attachments (3)
Change History (11)
Hmm, yes, it is an artifact. The goal was to avoid an extra query, as dd32 writes. 19743.diff is what was intended.
If the option doesn't exist in the database, it won't get auotloaded, which means WordPress needs to hit the options table to check for that individual row.
I think there's no need to save options into DB, before user save theme from options panel. Twenty Twelve is going use this solution and Lance mentioned, that Nacin had same idea for Twenty Eleven. The diff above removes it.
- Cc Otto42 added
- Keywords commit added
- Milestone changed from Awaiting Review to 3.4
- Priority changed from normal to high
- Severity changed from minor to normal
comment:8
markjaquith — 12 months ago
- Owner set to markjaquith
- Resolution set to fixed
- Status changed from new to closed
In [20875]:

For a new install this would mean an additional SQL each page load until they do something to cause the options to be set (for example, setting a theme option).