[wp-trac] [WordPress Trac] #6830: Eliminate all non-existent options in core and bundled themes/plugins

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 23 22:11:04 GMT 2008


#6830: Eliminate all non-existent options in core and bundled themes/plugins
--------------------------+-------------------------------------------------
 Reporter:  markjaquith   |       Owner:  anonymous
     Type:  defect        |      Status:  new      
 Priority:  high          |   Milestone:  2.6      
Component:  Optimization  |     Version:  2.5      
 Severity:  normal        |    Keywords:           
--------------------------+-------------------------------------------------
 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()}}}.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6830>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list