WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#5346 closed defect (bug) (fixed)

Cache current theme in options

Reported by: ryan Owned by:
Milestone: 2.5 Priority: normal
Severity: normal Version:
Component: General Keywords: performances themes
Focuses: Cc:

Description

get_theme_mod() calls get_current_theme() which in turn calls get_themes(). get_themes() scans and parses all themes. This means that themes that call get_theme_mod() scan and parse all themes on every page load. This includes themes that use the custom image header library. Profiling on my testbed revealed that 10% of the load time for the front page was due to get_theme_mod() and friends. Saving the current theme in options eliminates the need to rescan themes on every load.

Attachments (1)

current_theme.diff (2.2 KB) - added by ryan 13 years ago.
Adds switch_theme() and caches current theme in options

Download all attachments as: .zip

Change History (2)

@ryan
13 years ago

Adds switch_theme() and caches current theme in options

#1 @ryan
13 years ago

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

(In [6334]) Add switch_theme(). Cache current theme in options to avoid calling get_themes(). fixes #5346

Note: See TracTickets for help on using tickets.