Ticket #5346 (closed defect (bug): fixed)

Opened 4 years ago

Last modified 4 years ago

Cache current theme in options

Reported by: ryan Owned by: anonymous
Priority: normal Milestone: 2.5
Component: General Version:
Severity: normal Keywords: performances themes
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

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

Change History

ryan4 years ago

Adds switch_theme() and caches current theme in options

comment:1   ryan4 years ago

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

(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.