Ticket #1499 (closed defect (bug): fixed)
add_option shouldn't always check db for pre-existing option
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Optimization | Version: | 1.5.2 |
| Severity: | minor | Keywords: | bg|has-patch bg|commit |
| Cc: |
Description
Currently some plugins do the following everytime they are run:
add_option('my_opt',...);
get_option('my_opt',...);
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
Change History
-
attachment
functions.php.diff
added
comment:4
davidhouse — 7 years ago
Looks good. Caching is good :)
comment:5
markjaquith — 6 years ago
- Keywords bg|commit added; bg|2nd-opinion removed
- Owner changed from anonymous to markjaquith
- Version changed from 1.5.1.2 to 1.5.2
- Status changed from new to assigned
- Severity changed from trivial to minor
Old patch wasn't working. Recreated it. Let's get this in the core already! It creates a lot of extra queries!
- Status changed from assigned to closed
- Resolution set to fixed
Note: See
TracTickets for help on using
tickets.

Patch to functions.php to improve add_option