Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#15005 closed defect (bug) (wontfix)

Network theme assets are not efficiently cached

Reported by: berniecode Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Multisite Keywords:
Focuses: Cc:


In Wordpress 3, when you install a theme and activate it as a network theme, all sites share one set of theme files on disk. However, each site accesses the files through a different URL.

For example, if you have two sites, sitea and siteb, using a subfolder install and both using the theme "my-theme", the theme files will be accessed through:

http ://example.com/siteb/wp-content/themes/my-theme/style.css

Both these URLs point to the same file through URL rewriting, but the browser loads and caches them each separately so when navigating between sites, the assets loaded on one site are not reused from the cache for the next site.

The correct behaviour would be for each site to have a stylesheet loaded from



I have fixed this issue on my own site with a filter:

add_filter('theme_root_uri', 'alter_theme_root_uri');
function alter_theme_root_uri($theme_root_uri) {
    // replace
    //     http://example.com/sitename/wp-content/themes
    // with
    //     http://example.com/wp-content/themes
    return preg_replace('#/[\w-]+/(wp-content/themes)#', '/\1', $theme_root_uri);

Change History (2)

#1 @Denis-de-Bernardy
10 years ago

Won't the suggestion introduce issues in theme assets that are dynamic or user-specific?

#2 @PeteMall
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.