Ticket #6830 (new defect)

Opened 2 months ago

Last modified 2 months ago

Eliminate all non-existent options in core and bundled themes/plugins

Reported by: markjaquith Assigned to: anonymous
Priority: high Milestone: 2.6
Component: Optimization Version: 2.5
Severity: normal Keywords: has-patch needs-testing
Cc:

Description

Calling get_option() on non-existent options (without an object cache enabled) results in needless SQL queries.

Current ones in 2.5 with the Default theme:

array(3) {
  [0]=>
  string(82) "SELECT option_value FROM wptrunk_options WHERE option_name = 'widget_text' LIMIT 1"
  [1]=>
  float(0.000216960906982)
  [2]=>
  string(10) "get_option"
}
array(3) {
  [0]=>
  string(81) "SELECT option_value FROM wptrunk_options WHERE option_name = 'widget_rss' LIMIT 1"
  [1]=>
  float(0.000195980072021)
  [2]=>
  string(10) "get_option"
}
array(3) {
  [0]=>
  string(91) "SELECT option_value FROM wptrunk_options WHERE option_name = 'kubrick_header_image' LIMIT 1"
  [1]=>
  float(0.000408887863159)
  [2]=>
  string(10) "get_option"
}
array(3) {
  [0]=>
  string(91) "SELECT option_value FROM wptrunk_options WHERE option_name = 'kubrick_header_color' LIMIT 1"
  [1]=>
  float(0.000301837921143)
  [2]=>
  string(10) "get_option"
}
array(3) {
  [0]=>
  string(93) "SELECT option_value FROM wptrunk_options WHERE option_name = 'kubrick_header_display' LIMIT 1"
  [1]=>
  float(0.000277996063232)
  [2]=>
  string(10) "get_option"
}

They're quick, but it's sloppy that they're there at all. All of our options should be initialized with add_option().

Attachments

6830.001.diff (5.9 kB) - added by markjaquith on 05/01/08 20:11:19.

Change History

05/01/08 20:11:19 changed by markjaquith

  • attachment 6830.001.diff added.

05/01/08 20:13:40 changed by markjaquith

  • keywords set to has-patch needs-testing.

Patch initializes those options, as well as fixes some kubrick_header_color funkiness where it'd go blank and show grey text in the backend.