WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#33628 closed enhancement (maybelater)

Improve caching on get_theme_mods function

Reported by: spacedmonkey Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Themes Keywords:
Focuses: performance Cc:

Description

Currently whenever the get_theme_mods function is called, it calls the also the get_options function twice. This means that whenever the get_theme_mod / set_theme_mod / remove_theme_mod , also makes a call to options table. This value is not cached in memory, so whenever get_theme_mod is called it will get the values from the db / object cache.

To improve performance, after the first time the function is called, theme mods should be stored as a global / static variable.

Attachments (2)

wp_theme_mods_cache.patch (1.5 KB) - added by spacedmonkey 5 years ago.
wp_theme_mods_cache1.patch (2.2 KB) - added by spacedmonkey 5 years ago.

Download all attachments as: .zip

Change History (4)

#1 @spacedmonkey
5 years ago

  • Resolution set to maybelater
  • Status changed from new to closed

#2 @DrewAPicture
5 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.