Make WordPress Core

Opened 15 years ago

Closed 14 years ago

#19743 closed defect (bug) (fixed)

Trim code from Twenty Eleven theme-options

Reported by: emhr Owned by: markjaquith
Priority: high Milestone: 3.4
Component: Bundled Theme Version: 3.3.1
Severity: normal Keywords: has-patch commit
Cc: Focuses:

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)

twenty-eleven-options-patch.diff​ (803 bytes ) - added by emhr 15 years ago.
19743.diff​ (1.3 KB ) - added by nacin 15 years ago.
19743.2.diff​ (1.0 KB ) - added by Mamaduka 14 years ago.

Download all attachments as: .zip

Change History (11)

#1 @dd32
15 years ago

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).

@nacin
15 years ago

#2 @nacin
15 years ago

Hmm, yes, it is an artifact. The goal was to avoid an extra query, as dd32 writes. 19743.diff​ is what was intended.

#3 @emhr
15 years ago

Where is the extra query generated?

#4 @nacin
15 years ago

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.

#5 @emhr
15 years ago

Thanks

@Mamaduka
14 years ago

#6 @Mamaduka
14 years ago

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.

#7 @nacin
14 years ago

  • Cc Otto42 added
  • Keywords commit added
  • Milestone Awaiting Review → 3.4
  • Priority normal → high
  • Severity minor → normal

#8 @markjaquith
14 years ago

  • Owner set to markjaquith
  • Resolution → fixed
  • Status new → closed

In [20875]:

Remove some dead add_option() code in Twenty Eleven. props Mamaduka, emhr. fixes #19743

Note: See TracTickets for help on using tickets.