[wp-trac] [WordPress Trac] #26876: Default widgets causing unnecessary database queries

WordPress Trac noreply at wordpress.org
Mon Jan 20 08:43:09 UTC 2014


#26876: Default widgets causing unnecessary database queries
--------------------------+------------------------------
 Reporter:  codydh        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Widgets       |     Version:  3.0
 Severity:  minor         |  Resolution:
 Keywords:  needs-patch   |
--------------------------+------------------------------
Changes (by johnbillion):

 * keywords:   => needs-patch
 * version:  3.8 => 3.0


Comment:

 I've noticed this too. It's caused by the fact that these options aren't
 present in the database by default, which means they're not present in the
 array returned by `wp_load_all_options()`, which means `get_option()`
 falls back to a second database query to look for the value.

 Off the top of my head, we could solve this by inserting a default option
 value for each of these keys (in the upgrade routine), or we could avoid
 trying to fetch options for widgets that aren't in use.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/26876#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list