Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#1499 closed defect (bug) (fixed)

add_option shouldn't always check db for pre-existing option

Reported by: westi Owned by: markjaquith
Milestone: Priority: normal
Severity: minor Version: 1.5.2
Component: Optimization Keywords: bg|has-patch bg|commit
Focuses: Cc:


Currently some plugins do the following everytime they are run:


When these options are defined with autoload as yes wordpress automatically loads them at startup - the add_option code should check the cache to see if the option already exists before checking the db to save on queries.

Patch attached to do this cache checking.

Attachments (2)

functions.php.diff (674 bytes) - added by westi 16 years ago.
Patch to functions.php to improve add_option
functions.php.2.diff (564 bytes) - added by markjaquith 16 years ago.
Patch for WP 1.6 SVN

Download all attachments as: .zip

Change History (9)

16 years ago

Patch to functions.php to improve add_option

#1 @westi
16 years ago

  • Keywords bg|has-patch bg|2nd-opinion added

#2 @westi
16 years ago

  • Milestone set to 1.5.2

#3 @matt
16 years ago

  • Milestone changed from 1.5.2 to 1.6

#4 @davidhouse
16 years ago

Looks good. Caching is good :)

16 years ago

Patch for WP 1.6 SVN

#5 @markjaquith
16 years ago

  • Keywords bg|commit added; bg|2nd-opinion removed
  • Owner changed from anonymous to markjaquith
  • Severity changed from trivial to minor
  • Status changed from new to assigned
  • Version changed from to 1.5.2

Old patch wasn't working. Recreated it. Let's get this in the core already! It creates a lot of extra queries!

#6 @ryan
16 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [2856]) Check the option cache before querying. Props westi. fixes #1499

#7 @(none)
15 years ago

  • Milestone 2.0 deleted

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.