get_option() - store retrieved option in a global array?
|Reported by:||digitalnature||Owned by:|
Themes, plugins and core call this function a lot, and there are many times when the same option gets requested more than once.
I guess this is not a problem when the user has some kind of cache plugin turned on, but most people don't, so the same database query gets to run twice or more in the same request. This saves around 30% of db calls on a typical wp site.
Is it possible to store the value of a retrieved option in a global array? and when the same option is requested again it would get pulled out from that array instead of the db.
Or at least add a action hook in that function so we can override it :)
because option_optionname filter doesn't help...
Change History (18)
comment:2 follow-up: ↓ 3 digitalnature — 3 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed